Documentation Index
Fetch the complete documentation index at: https://private-7c7dfe99-test-mutation-observers.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Migrate to Managed Postgres using ClickHouse Cloud
ClickHouse Cloud includes a built-in import wizard that migrates your external PostgreSQL database into a Managed Postgres service. The wizard handles the source connection, schema export and import, replication settings, and table selection in five guided steps.Prerequisites
- Access to your source PostgreSQL database with a user that has replication privileges.
- A ClickHouse Managed Postgres service as the migration target. If you don’t have one yet, see the quickstart.
pg_dumpandpsqlinstalled on your local machine. Both ship with the standard PostgreSQL client tools.
Considerations before migrating
- DDL propagation: continuous replication (CDC) captures DML operations and
ADD COLUMN. Other DDL changes such asDROP COLUMNandALTER COLUMNaren’t propagated and must be applied manually on the target.
Step 1: Connect to your source database
Open the ClickHouse Cloud console and select your Managed Postgres service. In the left sidebar, click Data sources. Click Start import. Fill in the connection details for your source PostgreSQL database: host, port, username, password, and database name. Enable TLS if your source requires it. If you require a private connection to your source database, you can opt for SSH tunneling and provide the necessary SSH details. This allows the migration to securely connect to databases that aren’t publicly accessible. Choose an ingestion method:- Initial load + CDC — copies existing data, then keeps the target in sync with ongoing changes.
- Initial load only — one-time copy, no ongoing replication.
- CDC only — skips the initial copy and replicates only new changes from this point forward.
Step 2: Export your database schema
The wizard displays apg_dump command pre-filled with your source connection details. Run it in a terminal:
pg.sql in your current directory.
Click Next.
Step 3: Import the schema into your Managed Postgres service
Select the destination database from the dropdown, or click Create a new database to provision one. The wizard displays apsql command to apply the schema dump to your Managed Postgres service. Run it in a terminal:
Step 4: Configure ingestion settings
Specify the publication to use for logical replication. If you leave this blank, a publication is created automatically. Expand Advanced replication settings to tune throughput:| Setting | Default | Description |
|---|---|---|
| Sync interval (seconds) | 10 | How frequently the replication slot is polled |
| Parallel threads for initial load | 4 | Number of threads for the bulk copy phase |
| Pull batch size | 100,000 | Rows fetched per replication batch |
| Snapshot number of rows per partition | 100000 | Partition size for large table snapshots |
| Snapshot number of tables in parallel | 1 | Tables snapshotted concurrently |