PostgreSQL to ClickHouse Data Migration | NineData
Use this workflow when you need to move PostgreSQL data into ClickHouse for analytics, reporting, or downstream analysis. NineData Data Replication helps create the ClickHouse target structure and load the selected PostgreSQL data.
This page explains the scenario workflow. For detailed prerequisites, permissions, system columns, data type mapping, and precheck items, see PostgreSQL to ClickHouse.
When to use this workflow
Use this workflow when you need to:
- Move PostgreSQL tables into ClickHouse for analytics.
- Initialize ClickHouse table structures from PostgreSQL.
- Run large analytical queries in ClickHouse instead of the transactional PostgreSQL database.
- Validate replicated data before it is used by reporting or downstream systems.
Overview
PostgreSQL and ClickHouse use different table models. In a typical NineData workflow, schema replication creates the ClickHouse table structures and full replication loads the selected PostgreSQL data.
If you do not use schema replication, prepare the ClickHouse target tables manually. The table structures must match the PostgreSQL source objects, and the target tables must include the required system columns described in the canonical replication guide.
Before you begin
Prepare the following items:
- Access to the NineData console.
- Connection information and accounts for the PostgreSQL source and ClickHouse target.
- Required permissions on both systems.
- The required ClickHouse account configuration, including
access_management=1. - Network connectivity from NineData to both systems.
Step 1: Add the source and target data sources
In the NineData console, click Data Source Management > Data Sources, and then click Create Data Source.

Follow the page prompts, test the connection, and click Create Data Source.

Repeat the process for the PostgreSQL source and the ClickHouse target.
Step 2: Create the migration task
In the NineData console, click Data Replication > Data Replication, and then click Create Replication.

Configure the PostgreSQL source and ClickHouse target.
Select the replication types required for the task. For PostgreSQL to ClickHouse, use Schema Replication and Full Replication to create target structures and load existing data.

Select the source objects, configure mapping if needed, and run the precheck.
After the precheck passes, start the task.
Monitor the task until full replication completes.

Step 3: Validate replicated data
Open the replication task created in Step 2.

Click the Data Comparison tab, and click Start Data Comparison if comparison results are not already available.
tipAfter comparison starts, NineData compares the selected source and target objects and displays the comparison result.

Click Re-compare when you need to validate the latest result after another run.

Step 4: Configure alerts
Configure alerts so operators are notified if the migration task fails.
Open the replication task details page.

Click Configure Alerts.

Enter a Policy Name, review the alert rules, and click Save Configuration.

Result
After the task completes, ClickHouse contains the selected PostgreSQL table structures and full data. You can use the ClickHouse copy for analytical queries and reporting while keeping the PostgreSQL source focused on transactional workloads.