Use Data Transmission Service (DTS) to continuously replicate data from a MySQL database hosted on an ECS instance to an AnalyticDB for PostgreSQL instance. DTS handles both the initial full load and the ongoing incremental sync, keeping your analytics data current without manual intervention.
Prerequisites
Before you begin, ensure that you have:
-
A MySQL database (version 5.1, 5.5, 5.6, 5.7, or 8.0) running on an ECS instance
-
Binary logging enabled on the source MySQL database, and a database account created for the sync task. For setup instructions, see Create an account for a self-managed MySQL database and configure binary logging The database account needs the following permissions: SELECT (on objects to be synchronized), REPLICATION CLIENT, REPLICATION SLAVE, and SHOW VIEW.
-
Primary keys on all tables you plan to synchronize
-
An AnalyticDB for PostgreSQL instance. For setup instructions, see Create an AnalyticDB for PostgreSQL instance
Limitations
Supported objects: Tables only. You cannot synchronize databases or schemas directly.
Supported SQL operations:
-
DML: INSERT, UPDATE, DELETE
-
DDL: ADD COLUMN only CREATE TABLE is not supported. To sync a new table added after the task starts, manually add it to the selected objects. See Add an object to a data synchronization task.
Unsupported data types: BIT, VARBIT, GEOMETRY, ARRAY, UUID, TSQUERY, TSVECTOR, TXID_SNAPSHOT, POINT. DTS does not synchronize columns with these data types.
Prefix indexes: Prefix indexes are not synchronized. If your source tables use prefix indexes, data may fail to be synchronized.
Online DDL tools: Do not use gh-ost or pt-online-schema-change during an active synchronization task. Otherwise, data synchronization may fail.
Supported synchronization topologies
-
One-way one-to-one synchronization
-
One-way one-to-many synchronization
-
One-way many-to-one synchronization
Term mappings
MySQL and AnalyticDB for PostgreSQL use different terminology for the same concepts:
| MySQL | AnalyticDB for PostgreSQL |
|---|---|
| Database | Schema |
| Table | Table |
Set up a synchronization task
Step 1: Purchase a DTS instance
Purchase a DTS instance. On the buy page, set the following options:
-
Source Instance: MySQL
-
Target Instance: AnalyticDB for PostgreSQL
-
Synchronization Topology: One-Way Synchronization
Step 2: Configure the synchronization channel
-
Log on to the DTS console.
-
In the left-side navigation pane, click Data Synchronization.
-
At the top of the Synchronization Tasks page, select the region where the destination instance resides.
-
Find the DTS instance and click Configure Synchronization Channel in the Actions column.
-
Configure the source and destination instances.

Source instance details
Parameter Description Synchronization task name DTS generates a name automatically. Specify a descriptive name for easy identification. The name does not need to be unique. Instance type Select User-Created Database in ECS Instance. Instance region The source region you selected on the buy page. Read-only. Instance ID Select the ECS instance that hosts the self-managed MySQL database. Database type Set to MySQL. Read-only. Port number Enter the MySQL service port. Default: 3306. Database account Enter the MySQL account for the sync task. This account needs the permissions listed in Prerequisites. Database password Enter the password for the database account. Destination instance details
Parameter Description Instance type Set to AnalyticDB for PostgreSQL. Read-only. Instance region The destination region you selected on the buy page. Read-only. Instance ID Select the destination AnalyticDB for PostgreSQL instance. Database name Enter the name of the destination database. Database account Enter the initial account of the AnalyticDB for PostgreSQL instance, or an account with the RDS_SUPERUSER permission. For more information, see Create a database account and Manage users and permissions. Database password Enter the password for the destination database account. -
Click Set Whitelist and Next.
DTS automatically adds the CIDR blocks of DTS servers to the ECS instance's inbound rule and the AnalyticDB for PostgreSQL whitelist, so DTS can reach both instances.
Step 3: Select objects and synchronization policy
Configure the following settings:
| Setting | Options and description |
|---|---|
| Initial synchronization | Select both Initial Schema Synchronization and Initial Full Data Synchronization. DTS copies the schema and data to the destination instance before starting incremental sync. |
| Processing mode of conflicting tables | Clear Target Table: Clears destination table data before the initial full sync. Use this when you want to start fresh or after a test run. Ignore: Appends data to existing records. Use this when merging data from multiple source tables into one destination table. |
| Synchronization type | Select the DML operations to synchronize: Insert, Update, Delete, AlterTable. |
| Objects to synchronize | In the Available section, select the tables to sync and move them to the Selected section using the |
| Replicate temporary tables when DMS performs DDL operations | Applies if you use DMS to run online DDL operations on the source. Yes: Syncs temporary tables generated by online DDL operations. Large DDL operations can cause sync delays. No: Skips temporary tables and syncs only the original DDL data. This may lock destination tables. |
| Retry time for failed connections | Default: 720 minutes (12 hours). DTS retries the connection within this window. If the connection is restored in time, the sync task resumes automatically. Set this based on your availability requirements. You are charged for the DTS instance during the retry window. |
Step 4: Set primary key and distribution columns (initial schema sync only)
This step appears only if you selected Initial Schema Synchronization. Specify the primary key column and distribution column for each table being synced to AnalyticDB for PostgreSQL.
For more information, see Define constraints and Define table distribution.
Step 5: Run the precheck and start synchronization
-
Click Precheck in the lower-right corner. DTS validates the configuration before starting the task. If any check fails, click the
icon next to the failed item for details. Fix the issue and rerun the precheck. If a failed item is not critical to your use case, click Ignore to bypass it, then run the precheck again. -
When The precheck is passed appears, close the dialog. The synchronization task starts automatically.
-
Wait for the initial synchronization to complete. The task status changes to Synchronizing once incremental sync begins. Monitor the task status on the Synchronization Tasks page.

Performance considerations
DTS reads from the source and writes to the destination concurrently during the initial full data synchronization. On databases with heavy load, low specifications, or large data volumes, this can affect performance. To minimize impact, run the synchronization during off-peak hours when CPU utilization on both the source and destination is below 30%.