All Products
Search
Document Center

Data Transmission Service:Synchronize data between AnalyticDB for PostgreSQL instances

Last Updated:Apr 01, 2026

Use Data Transmission Service (DTS) to set up continuous data synchronization between two AnalyticDB for PostgreSQL instances. DTS runs schema synchronization, full data synchronization, and incremental data synchronization in sequence, keeping the destination instance up to date with changes from the source.

Prerequisites

Before you begin, make sure that:

  • The destination AnalyticDB for PostgreSQL instance is created. Its storage space must be larger than the data volume on the source instance. See Create an instance.

  • A database exists in the destination instance to receive the synchronized data. See SQL syntax.

Billing

Synchronization type Fee
Schema synchronization and full data synchronization Free
Incremental data synchronization Charged. See Billing overview.

Supported objects and SQL operations

Supported objects

Object Supported
SCHEMA, TABLE (including primary key, UNIQUE KEY, built-in data types, DEFAULT CONSTRAINT) Yes
VIEW, INDEX, PROCEDURE, FUNCTION, RULE, SEQUENCE, AGGREGATE, OPERATOR, DOMAIN No

SQL operations for incremental synchronization

Operation type SQL operations
DML INSERT, UPDATE, DELETE

DDL operations are not supported. New tables created in the source database after the task starts and their subsequent data changes are not synchronized to the destination. To synchronize these changes, you must create a new synchronization task.

Custom data type support

The following table shows which custom data types DTS handles during synchronization:

Data type Result Notes
COMPOSITE Partial Synchronized as a basic type
ENUM Partial Synchronized
RANGE Partial Synchronized
C-language functions Not synchronized Reimplement in destination manually
Internal PROCEDURE and FUNCTION Not synchronized Reimplement in destination manually
Extensions Not synchronized Install extensions manually on the destination
Partitioned tables Partial Partition structure is lost; created as non-partitioned tables in destination

DTS does not synchronize tables with cross-schema inheritance, temporary tables, or internal system triggers from the source database.

Required permissions

Database Required permissions How to grant
Source AnalyticDB for PostgreSQL Read permissions on objects to be synchronized, plus the REPLICATION permission See Create and manage users. Grant the REPLICATION permission by running: ALTER USER <username> WITH REPLICATION;
Destination AnalyticDB for PostgreSQL Read and write permissions on the destination database See Create and manage users. Use the initial account or an account with RDS_SUPERUSER permissions.

Limitations

Source database requirements

Requirement Details Workaround if not met
Bandwidth The server hosting the source database must have outbound bandwidth of 100 Mb/s or higher. Upgrade server bandwidth or throttle DTS during off-peak hours.
Kernel version The source instance must run kernel version 7.2.1.4 or later. Upgrade the source instance kernel before starting.
wal_level parameter Set wal_level to logical to enable logical decoding. Update the parameter in the AnalyticDB for PostgreSQL console.
High-availability Edition parameters If the source instance is the High-availability Edition, also set hot_standby, hot_standby_feedback, and sync_replication_slots to on. This prevents the logical subscription from being interrupted by a primary/secondary switchover. Update the parameters in the console before creating the task.

Synchronization object requirements

Requirement Details Workaround if not met
Database name The database name cannot contain hyphens (-). For example, dts-testdata is not valid. Rename the database before creating the task.
Primary keys Tables must have primary keys or UNIQUE constraints with unique values. Without them, duplicate data may appear in the destination. Add a primary key or UNIQUE constraint to the table before starting the task.
Table-level synchronization limit If you synchronize at the table level, apply object name mappings, and the task includes more than 5,000 tables, the task may fail. Split tables across multiple tasks, or configure the task to synchronize the entire database instead.

Other limitations

  • One synchronization task covers one database. Create separate tasks for each additional database.

  • After schema synchronization, the schema owner in the destination becomes the database account configured for the task.

  • By default, the distribution key is unchanged during schema synchronization. If the source table has a primary key, the destination table uses the same primary key column as the distribution key. If there is no primary key, the distribution key is used as the primary key column.

  • If source tables contain SERIAL-type fields, the source database creates a sequence for these fields automatically. When configuring Source Objects, if Synchronization Types includes Schema Synchronization, also select Sequence or synchronize the entire schema. Otherwise, the synchronization task may fail.

  • DTS validates data content but does not validate metadata such as sequences. Validate sequences manually before cutover.

  • During initial schema and full data synchronization, do not run Data Definition Language (DDL) operations that change database or table schemas. The task will fail if DDL operations are performed during this phase.

During full data synchronization, DTS queries the source database, creating metadata locks that may block DDL operations on the source.
  • Long-running transactions on the source database can cause Write-Ahead Logging (WAL) logs to accumulate before the transactions commit, potentially exhausting disk space on the source.

  • Full initialization uses concurrent INSERT operations, causing table fragmentation in the destination. Tables in the destination may occupy more storage space than in the source.

  • Before you synchronize data, evaluate the performance of the source and destination databases. We recommend that you perform data synchronization during off-peak hours, for example, when the CPU load of the source and destination databases is below 30%.

  • Do not change the endpoint or availability zone of an AnalyticDB for PostgreSQL instance while the synchronization task is running.

  • If a data source other than DTS writes to the destination database during synchronization, data inconsistency may occur and the task may fail.

REPLICA IDENTITY requirement

In the following three scenarios, run ALTER TABLE schema.table REPLICA IDENTITY FULL; on the tables to be synchronized before writing data to them. Run this command during off-peak hours to avoid table locks.

  • When the instance runs for the first time.

  • When synchronizing at the schema level and a new table is created, or an existing table is rebuilt using the RENAME command.

  • When using the modify-synchronization-objects feature.

Replace schema and table with the actual schema name and table name. If you skip the related precheck, DTS runs this command automatically during initialization.

Replication slot behavior

DTS creates a replication slot prefixed with dts_sync_ in the source database. This slot provides access to incremental logs from the last 15 minutes.

DTS cleans up the replication slot when the task fails or the instance is released. The slot is not cleaned up automatically if you change the source database account password or remove the DTS IP address from the source database whitelist during synchronization. In that case, clean up the replication slot manually to prevent disk space accumulation.

If a primary/secondary failover occurs, log in to the secondary database to clean up the replication slot.
Amazon slot查询信息

Temporary tables created by DTS

DTS creates the following temporary tables in the source database to support incremental synchronization. Do not delete them while the task is running — they are removed automatically when the DTS instance is released.

public.dts_pg_class, public.dts_pg_attribute, public.dts_pg_type, public.dts_pg_enum, public.dts_postgres_heartbeat, public.dts_ddl_command, public.dts_args_session, and public.aliyun_dts_instance.

Set up a data synchronization task

The setup consists of four steps: navigate to the Data Synchronization page, configure source and destination databases, configure synchronization objects, then run the precheck and purchase the instance.

Step 1: Go to the Data Synchronization page

DTS console

  1. Log on to the DTS console.DTS console

  2. In the left-side navigation pane, click Data Synchronization.

  3. In the upper-left corner, select the region where the synchronization instance resides.

DMS console

The operations may vary based on the mode and layout of the DMS console. See Simple mode and Customize the layout and style of the DMS console.
  1. Log on to the DMS console.DMS console

  2. In the top navigation bar, move the pointer over Data + AI and choose DTS (DTS) > Data Synchronization.

  3. From the drop-down list to the right of Data Synchronization Tasks, select the region where the synchronization instance resides.

Step 2: Configure source and destination databases

  1. Click Create Task.

  2. Configure the parameters described in the following table.

Category Parameter Description
Task Name A name for the DTS task. DTS generates a name automatically. Specify a descriptive name to make the task easy to identify. The name does not need to be unique.
Source Database Select Existing Connection If the source instance is registered with DTS, select it from the drop-down list — DTS fills in the remaining parameters automatically. See Manage database connections. In the DMS console, select from the Select a DMS database instance list. If the instance is not registered, enter the connection details manually.
Database Type Select AnalyticDB for PostgreSQL.
Access Method Select Alibaba Cloud Instance.
Instance Region Select the region of the source instance.
Replicate Data Across Alibaba Cloud Accounts Select No to use a database in the current Alibaba Cloud account.
Instance ID Select the ID of the source AnalyticDB for PostgreSQL instance.
Database Name Enter the name of the database to synchronize from.
Database Account Enter the database account for the source instance.
Database Password Enter the password for the database account.
Destination Database Select Existing Connection If the destination instance is registered with DTS, select it from the drop-down list. In the DMS console, select from the Select a DMS database instance list. If the instance is not registered, enter the connection details manually.
Database Type Select AnalyticDB for PostgreSQL.
Access Method Select Alibaba Cloud Instance.
Instance Region Select the region of the destination instance.
Instance ID Select the ID of the destination AnalyticDB for PostgreSQL instance.
Database Name Enter the name of the destination database that will receive the synchronized data.
Database Account Enter the database account for the destination instance.
Database Password Enter the password for the database account.
  1. Click Test Connectivity and Proceed.

Make sure the DTS server CIDR blocks are added to the security settings of the source and destination databases. See Add DTS server IP addresses to a whitelist.

Step 3: Configure synchronization objects

  1. In the Configure Objects step, set the following parameters.

Parameter Description
Synchronization Types Select Schema Synchronization, Full Data Synchronization, and Incremental Data Synchronization. Full data synchronization copies the historical data needed as the basis for incremental synchronization.
DDL and DML Operations to Be Synchronized Select the SQL operations for incremental synchronization at the instance level. To configure at the schema or table level, right-click a synchronization object in Selected Objects and choose the desired operations.
Processing Mode of Conflicting Tables Precheck and Report Errors (default): checks whether tables in the destination have the same names as tables in the source. If identical names exist, the precheck fails and the task cannot start. To work around naming conflicts, use the object name mapping feature to rename the tables in the destination. Ignore Errors and Proceed: skips the naming check. During full synchronization, conflicting rows in the destination are kept. During incremental synchronization, conflicting rows are overwritten. If the source and destination have different schemas, initialization may fail or only some columns may be synchronized.
Storage Engine Type Select the storage engine for the destination tables. Default: Beam. Available only if the destination instance runs kernel version v7.0.6.6 or later and Schema Synchronization is selected.
Capitalization of Object Names in Destination Instance Controls how database names, table names, and column names are capitalized in the destination. Default: DTS default policy. See Specify the capitalization of object names in the destination instance.
Source Objects Select one or more objects and click the 向右 icon to move them to Selected Objects. Select at the schema or table level.
Selected Objects To rename an object in the destination or map it to a different receiving object, right-click it. See Map object names. To remove an object, click it and then click the image icon. To filter rows by condition, right-click a table and specify the WHERE clause. See Specify filter conditions.
Renaming an object with object name mapping may cause dependent objects to fail synchronization.
  1. Click Next: Advanced Settings and configure the following parameters.

Parameter Description
Dedicated Cluster for Task Scheduling By default, DTS schedules the task to the shared cluster. Purchase a dedicated cluster for improved stability. See What is a DTS dedicated cluster.
Retry Time for Failed Connections How long DTS retries a failed connection after the task starts. Valid values: 10–1440 minutes. Default: 720 minutes. Set this to at least 30 minutes. If multiple tasks share the same source or destination, the shortest retry time takes precedence. During retries, the DTS instance continues to incur charges.
Retry Time for Other Issues How long DTS retries failed DDL or DML operations. Valid values: 1–1440 minutes. Default: 10 minutes. Set this to at least 10 minutes. This value must be smaller than Retry Time for Failed Connections.
Enable Throttling for Full Data Synchronization Limits the load on source and destination databases during full data synchronization. Configure QPS to the source database, RPS of Full Data Migration, and Data migration speed for full migration (MB/s). Available only if Full Data Synchronization is selected.
Enable Throttling for Incremental Data Synchronization Limits the load during incremental synchronization. Configure RPS of Incremental Data Synchronization and Data synchronization speed for incremental synchronization (MB/s).
Environment Tag An optional tag to identify the instance's environment.
Configure ETL Select Yesalert notification settings to enable the extract, transform, and load (ETL) feature and enter data processing statements. See Configure ETL. Select No to skip.
Monitoring and Alerting Select Yes to receive alerts when the task fails or synchronization latency exceeds a threshold. Configure the alert threshold and notification settings. See Configure monitoring and alerting.
  1. (Optional) Click Next: Configure Database and Table Fields to set the Type, Primary Key Column, and Distribution Key for tables to be synchronized to the destination instance. You can select multiple columns for the primary key to create a composite primary key — at least one primary key column must also be the distribution key. See Manage data tables and Table distribution definition.

This step is available only if Schema Synchronization is selected in Synchronization Types. Set Definition Status to All to view and edit all tables.

Step 4: Run the precheck and purchase the instance

  1. Click Next: Save Task Settings and Precheck.

To preview the OpenAPI parameters for this task configuration, hover over the button and click Preview OpenAPI parameters before clicking it.

DTS performs a precheck before the task can start.

  • If the precheck fails, click View Details next to each failed item, fix the issue, and run the precheck again.

  • If an alert appears for an item that can be ignored, click Confirm Alert Details, then Ignore, then OK, then Precheck Again. Ignoring alerts may cause data inconsistency.

  1. Wait until Success Rate reaches 100%, then click Next: Purchase Instance.

  2. On the purchase page, configure the following parameters.

Parameter Description
Billing Method Subscription: pay upfront for one to nine months, or one, two, three, or five years. More cost-effective for long-term use. Pay-as-you-go: billed hourly. Suitable for short-term use. Release the instance when no longer needed to stop charges.
Resource Group Settings The resource group for the synchronization instance. Default: default resource group. See What is Resource Management?
Instance Class The synchronization speed varies by instance class. See Instance classes of data synchronization instances.
Subscription Duration Available for the Subscription billing method only. Specify the duration and the number of instances to create.
  1. Read and select Data Transmission Service (Pay-as-you-go) Service Terms.

  2. Click Buy and Start, then click OK in the dialog box.

The task appears in the task list. Monitor its progress from there.

Prepare for cutover

Before switching your business traffic to the destination instance, complete the following steps.

Verify synchronization latency

To ensure the accuracy of the displayed synchronization latency, DTS adds a heartbeat table named dts_postgres_heartbeat to the source database. Monitor the latency value in the DTS console task list before switching traffic.

Handle sequences

After switching to the destination, new sequences do not automatically start from the maximum value of the source sequences. Before cutover, query the maximum sequence values in the source and set them as the starting values in the destination.

Run the following command on the source database to get the required setval statements:

do language plpgsql $$
declare
  nsp name;
  rel name;
  val int8;
begin
  for nsp,rel in select nspname,relname from pg_class t2 , pg_namespace t3 where t2.relnamespace=t3.oid and t2.relkind='S'
  loop
    execute format($_$select last_value from %I.%I$_$, nsp, rel) into val;
    raise notice '%',
    format($_$select setval('%I.%I'::regclass, %s);$_$, nsp, rel, val+1);
  end loop;
end;
$$;

The output includes setval statements for all sequences in the source database. Run the relevant statements on the destination database as required before cutover.

DTS validates data content but does not validate sequence metadata. Validate sequences manually.

What's next

  • To adjust DTS instance parameters after the task starts, see Modify instance parameters. Only DTS instance parameters are modified — database parameters are not affected. The parameters that may be modified include but are not limited to those described in the linked topic.

  • If the synchronization instance fails, DTS helpdesk will try to recover the instance within 8 hours. Recovery may involve restarting the instance or adjusting its parameters.

  • To synchronize data from additional databases, create a separate synchronization task for each database.