Before you begin
Ensure you have the following:- A PostgreSQL database (versions 11-16 supported)
- A CockroachDB cluster (Cloud or Self-Hosted)
- Network connectivity between source and target databases
- Appropriate user permissions on both databases
Installation
Install the MOLT CLI tools:Migration workflow
Convert the schema
Use the MOLT Schema Conversion Tool to convert your PostgreSQL schema to CockroachDB-compatible DDL.The tool will:
The Schema Conversion Tool is available in the CockroachDB Cloud Console under the Migrations page.
- Identify unimplemented features
- Rewrite unsupported DDL syntax
- Apply CockroachDB schema best practices
Apply the schema
After conversion, apply the schema to CockroachDB:Load data with MOLT Fetch
Set connection strings
For bulk load (with downtime)
Perform a one-time bulk load:For minimal downtime migration
Create replication slot and load data:MOLT Fetch supports multiple data paths:
- Cloud storage: S3, GCS, or Azure Blob Storage
- Local file server: For network-isolated environments
- Direct copy: Stream data directly (use
--direct-copyflag)
Verify data consistency
Use MOLT Verify to confirm data consistency:MOLT Verify checks:
- Table structure and column definitions
- Row counts
- Row-level data consistency
Start continuous replication (optional)
For minimal downtime migrations, start MOLT Replicator to replicate ongoing changes:Key metrics to monitor:
Monitor replication
Access replication metrics at:replication_lag_seconds: Time lag between source and targetmutations_applied: Number of changes appliedmutations_pending: Number of changes queued
Recreate constraints and indexes
After data load completes, recreate the constraints and indexes you dropped:
Cutover to CockroachDB
Pre-cutover checklist
- Verify data consistency with MOLT Verify
- Confirm replication lag is minimal (if using replication)
- Test application queries on CockroachDB
- Prepare rollback plan
Cutover procedure
- Stop application writes to the source database
- Wait for replication to drain (if using continuous replication)
- Run final verification with MOLT Verify
- Update connection strings in your application to point to CockroachDB
- Start application traffic on CockroachDB
Troubleshooting
Connection issues
SSL/TLS connection errors
SSL/TLS connection errors
Ensure your connection strings include the correct SSL mode:
Authentication failures
Authentication failures
Verify user permissions:
Performance issues
- Increase concurrency: Use
--table-concurrencyand--export-concurrencyflags - Adjust batch sizes: Use
--row-batch-sizeto tune shard size - Enable compression: Use
--compression gzipfor cloud storage
Data type incompatibilities
Next steps
Schema Design
Optimize your schema for CockroachDB
Migration Strategy
Plan your migration approach