Migration Overview

On this page Carat arrow pointing down

CockroachDB supports importing data from the following databases:

  • MySQL
  • Postgres

and from the following data formats:

  • CSV/TSV

This page lists general considerations to be aware of as you plan your migration to CockroachDB.

In addition to the information listed below, see the following pages for specific instructions and considerations that apply to the database (or data format) you're migrating from:

File storage during import

During migration, all of the features of IMPORT that interact with external file storage assume that every node has the exact same view of that storage. In other words, in order to import from a file, every node needs to have the same access to that file.

Schema and application changes

In general, you are likely to have to make changes to your schema, and how your app interacts with the database. We strongly recommend testing your application against CockroachDB to ensure that:

  1. The state of your data is what you expect post-migration.
  2. Performance is as expected for your application's workloads. You may need to apply some best practices for optimizing SQL performance in CockroachDB.

Data type sizes

Above a certain size, many data types such as STRINGs, DECIMALs, ARRAY, BYTES, and JSONB may run into performance issues due to write amplification. See each data type's documentation for its recommended size limits.

Unsupported data types

CockroachDB does not provide ENUM or SET data types.

In Postgres, you can emulate an ENUM type using a CHECK constraint as shown below. For MySQL, we perform this conversion automatically during the import.

icon/buttons/copy
> CREATE TABLE orders (
    id UUID PRIMARY KEY,
    -- ...
    status STRING check (
      status='processing' or status='in-transit' or status='delivered'
    ) NOT NULL,
    -- ...
  );

See also


Yes No
On this page

Yes No