All Products
Search
Document Center

Data Transmission Service:Synchronize PolarDB for PostgreSQL to RDS PostgreSQL

Last Updated:Mar 28, 2026

Data Transmission Service (DTS) supports real-time data synchronization from a PolarDB for PostgreSQL cluster to an ApsaraDB RDS for PostgreSQL instance. Both full data synchronization and incremental data synchronization (Change Data Capture) are available, enabling continuous replication with minimal application downtime.

Prerequisites

Before you begin, ensure that you have:

Billing

Synchronization typePricing
Schema synchronization and full data synchronizationFree of charge
Incremental data synchronizationCharged. For details, see Billing overview

Supported synchronization topologies

  • One-way one-to-one synchronization

  • One-way one-to-many synchronization

  • One-way many-to-one synchronization

For descriptions and notes about each topology, see Synchronization topologies.

Supported synchronization objects

SCHEMA, TABLE

Includes PRIMARY KEY, UNIQUE KEY, FOREIGN KEY, built-in data types, and DEFAULT CONSTRAINT. The list of supported features varies depending on the destination database type. Check the console for the latest list.

Supported SQL operations

Operation typeSQL statements
DMLINSERT, UPDATE, DELETE
DDLSee details below

DDL synchronization is supported only for tasks created after October 1, 2020. When the source database account has privileged permissions, the following DDL operations are supported:

  • CREATE TABLE, DROP TABLE

  • ALTER TABLE (including RENAME TABLE, ADD COLUMN, ADD COLUMN DEFAULT, ALTER COLUMN TYPE, DROP COLUMN, ADD CONSTRAINT, ADD CONSTRAINT CHECK, ALTER COLUMN DROP DEFAULT)

  • TRUNCATE TABLE (requires the source PolarDB for PostgreSQL Database Engine to be PostgreSQL 11 or later)

  • CREATE INDEX ON TABLE

DDL limitations:

  • DDL statements containing CASCADE or RESTRICT clauses are not supported. For example, the following statement is not captured:

    DROP TABLE orders CASCADE;
  • DDL statements executed in sessions where SET session_replication_role = replica is set are not supported.

  • DDL statements executed by calling functions are not supported. For example, the following DDL inside a function body is not captured:

    CREATE OR REPLACE FUNCTION create_temp_table() RETURNS void
    LANGUAGE plpgsql AS $$
    BEGIN
      CREATE TABLE temp_data (id serial PRIMARY KEY, payload jsonb);
    END;
    $$;
  • If a single transaction contains both DML and DDL statements, the DDL statement is not synchronized.

  • If a single transaction contains DDL statements for objects not selected for synchronization, those DDL statements are not synchronized.

Important

Limitations

Source database requirements

  • Primary key or non-null unique index required. Tables to be synchronized must have a primary key or a non-null unique index. Without one, DTS cannot reliably synchronize UPDATE and DELETE operations on that table—those operations are silently skipped, and data consistency cannot be guaranteed. If this affects your tables, consider adding a primary key or unique index before starting the task.

  • Avoid long-running transactions during incremental synchronization. Long-running transactions cause write-ahead log (WAL) files to accumulate before commit, which can exhaust source disk space.

  • Logical Replication Slot Failover must be enabled. The PolarDB for PostgreSQL cluster must support and enable Logical Replication Slot Failover. If the cluster does not support this feature (for example, when the Database Engine is PostgreSQL 14), a high-availability (HA) switchover may cause the synchronization instance to fail unrecoverably.

  • 256 MB incremental data limit. If a single piece of data exceeds 256 MB after an incremental change, the synchronization instance may fail unrecoverably. In this case, reconfigure the synchronization instance.

  • No DDL operations during schema or full synchronization. Do not run DDL operations that change database or table schemas during schema synchronization or full data synchronization—such operations cause the synchronization task to fail.

    During full data synchronization, DTS queries the source database, which creates metadata locks that may block DDL operations.

Other limitations

  • One database per task. A single synchronization task can synchronize only one database. Configure a separate task for each additional database.

  • Unsupported table types. DTS does not support synchronizing:

    • TimescaleDB extension tables

    • Tables with cross-schema inheritance

    • Tables with unique indexes based on expressions

    • Schemas created by installing plugins

  • REPLICA IDENTITY FULL requirement. Before writing data to the following tables in the source database, run ALTER TABLE schema.table REPLICA IDENTITY FULL; on them to ensure data consistency. Run the command during off-peak hours and do not lock the tables while the command runs to avoid deadlocks. If you skip the related precheck items, DTS runs this command automatically during instance initialization. This applies in three scenarios:

    • The instance is running for the first time.

    • You selected schema as the synchronization granularity, and a new table was created in the schema or a table was rebuilt using the RENAME command.

    • You used the modify synchronization objects feature to update the task configuration.

    In the command, replace schema and table with the actual schema name and table name.
  • SERIAL type fields require Sequence synchronization. If a table contains a SERIAL-type field, the source database automatically creates a sequence for that field. When Schema Synchronization is selected as a synchronization type, also select Sequence or synchronize the entire schema. Otherwise, the synchronization instance may fail.

  • Run tasks during off-peak hours. Initial full data synchronization consumes read and write resources on both the source and destination databases. Running during peak hours increases database load.

  • Destination table space is larger after full synchronization. Initial full data synchronization runs concurrent INSERT operations, which causes table fragmentation in the destination database. As a result, the table space in the destination instance is larger than in the source instance after initial full data synchronization completes.

  • Do not write to the destination from other sources. During synchronization, do not write data to the destination database from sources other than DTS. Doing so causes data inconsistency. For example, using Data Management Service (DMS) to perform online DDL operations while other data is being written to the destination may result in data loss.

  • Metadata validation is not automatic. DTS validates data content but does not validate metadata such as sequences. Validate metadata separately after synchronization completes.

  • DTS creates temporary tables in the source database. DTS creates the following temporary tables to obtain DDL statements, incremental table structures, and heartbeat information. Do not delete these tables during synchronization—they are automatically deleted 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

  • Replication slot management. DTS creates a replication slot with the dts_sync_ prefix in the source database to replicate data. This slot retains incremental logs for the last 15 minutes. When a synchronization task fails or the synchronization instance is released, DTS attempts to automatically clear the slot.

    - If the password of the source database account used by the task is changed, or the DTS IP address is removed from the source database whitelist during synchronization, the slot cannot be automatically cleared. In this case, manually clear the replication slot in the source database to prevent disk space accumulation. - If a failover occurs in the source database, log on to the secondary database to manually clear the slot.

    Amazon slot查询信息

  • Update sequence values before business cutover. After switching your business to the destination instance, new sequences do not increment from the maximum value of the source sequence. Before the business cutover, update the sequence value in the destination database. For details, see Update the sequence value in the destination database.

  • session_replication_role for tables with foreign keys or triggers. For full or incremental synchronization tasks on tables containing foreign keys, triggers, or event triggers: if the destination database account has privileged or superuser permissions, DTS automatically sets the session_replication_role parameter to replica at the session level. If the account does not have these permissions, manually set the parameter to replica in the destination database. While session_replication_role is replica, cascade update or delete operations in the source database may cause data inconsistency. After the DTS task is released, set the parameter back to origin.

  • Task failure recovery. If a task fails, DTS support staff attempt to restore it within eight hours. During restoration, they may restart the task or adjust task parameters (not database parameters). For adjustable parameters, see Modify instance parameters.

  • Partitioned tables require parent and child partitions. When synchronizing partitioned tables, include both the parent table and all its child partitions as synchronization objects. The parent table of a PostgreSQL partitioned table does not directly store data—all data is in the child partitions. Excluding child partitions results in data inconsistency.

Notes on schema synchronization

  • DTS synchronizes foreign keys from the source database to the destination database during schema synchronization.

  • During full data synchronization and incremental data synchronization, DTS temporarily disables constraint checks and foreign key cascade operations at the session level. Data inconsistency may occur if cascade update or delete operations are performed on the source database while the task is running.

Configure a synchronization task

The configuration involves seven steps: go to the task list, create a task, configure source and destination databases, configure synchronization objects, configure advanced settings, run a precheck, and purchase the instance.

Step 1: Go to the data synchronization task list

Go to the task list in one of two ways:

DTS console

  1. Log on to the DTS console.DTS console

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

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

DMS console

Note

The exact steps may vary depending on the mode and layout of the DMS console. For details, see Simple mode console and Customize the layout and style of the DMS console.

  1. Log on to the DMS console.DMS console

  2. In the top menu bar, choose Data + AI > DTS (DTS) > Data Synchronization.

  3. To the right of Data Synchronization Tasks, select the region of the synchronization instance.

Step 2: Create a task

Click Create Task to open the task configuration page.

Step 3: Configure source and destination databases

CategoryParameterDescription
Task NameDTS auto-generates a name. Specify a descriptive name for easy identification. The name does not need to be unique.
Source DatabaseDatabase TypeSelect PolarDB for PostgreSQL.
Connection TypeSelect Cloud Instance.
Instance RegionSelect the region where the PolarDB for PostgreSQL cluster resides.
Cross Alibaba Cloud AccountSelect Not Cross-Account when the source and destination are under the same Alibaba Cloud account.
Instance IDSelect the ID of the source PolarDB for PostgreSQL cluster.
Database NameEnter the name of the PolarDB for PostgreSQL database.
Database AccountEnter the database account for PolarDB for PostgreSQL.
Database PasswordEnter the password for the specified account.
Destination DatabaseDatabase TypeSelect PostgreSQL.
Connection TypeSelect Cloud Instance.
Instance RegionSelect the region where the destination RDS PostgreSQL instance resides.
Instance IDSelect the ID of the destination RDS PostgreSQL instance.
Database NameEnter the name of the database in the destination RDS PostgreSQL instance that contains the objects to synchronize.
Database AccountEnter the database account for the destination RDS PostgreSQL instance. The account must have owner permissions on the schema. For instructions on creating and authorizing accounts, see Create an account.
Database PasswordEnter the password for the specified account.
EncryptionSpecifies whether to encrypt the connection to the source database. Select Non-encrypted or SSL-encrypted based on your requirements. If you select SSL-encrypted, upload the CA Certificate, Client Certificate, and Private Key of Client Certificate as needed, then specify the Private Key Password of Client Certificate.
If you set Encryption to SSL-encrypted for a self-managed PostgreSQL database, you must upload a CA Certificate.
To use a client certificate, upload Client Certificate and Private Key of Client Certificate, and specify Private Key Password of Client Certificate.
For information on configuring SSL encryption for RDS PostgreSQL, see SSL encryption.

After completing the configuration, click Test Connectivity and Proceed at the bottom of the page.

Add the CIDR blocks of the DTS servers to the security settings of both the source and destination databases (either automatically or manually). For details, see Add the IP address whitelist of DTS servers.
If the source or destination is a self-managed database (that is, the Access Method is not Alibaba Cloud Instance), also click Test Connectivity in the CIDR Blocks of DTS Servers dialog box.

Step 4: Configure synchronization objects

On the Configure Objects page, configure the synchronization settings.

ParameterDescription
Synchronization TypesBy default, Incremental Data Synchronization is selected. Also select Schema Synchronization and Full Data Synchronization. After the precheck passes, DTS synchronizes the historical data of the selected objects from the source to the destination as the basis for incremental synchronization.
Processing Mode of Conflicting TablesPrecheck and Report Errors: Checks for tables with the same names in the destination. If any are found, an error is reported during precheck and the task does not start. If you cannot delete or rename the conflicting table, map it to a different name. See Database table column name mapping. Ignore Errors and Proceed: Skips the check.
Warning

This may cause data inconsistency. During full data synchronization, if the table schemas are consistent and a record in the destination has the same primary key or unique key as the source, DTS retains the destination record and skips the source record. During incremental synchronization, DTS overwrites the destination record. If table schemas are inconsistent, initialization may fail, resulting in partial or complete synchronization failure.

Case Policy for Destination Object NamesConfigure the case-sensitivity policy for database, table, and column names in the destination. The default is DTS default policy. For details, see Case policy for destination object names.
Source ObjectsIn the Source Objects box, click the objects, then click the right-arrow icon to move them to the Selected Objects box. You can select schemas or tables. If you select tables, other objects such as views, triggers, and stored procedures are not synchronized. If a table contains a SERIAL data type and Schema Synchronization is selected, also select Sequence or entire schema synchronization.
Selected ObjectsTo rename a single object in the destination, right-click it in the Selected Objects box. See Map a single object name. To rename multiple objects in bulk, click Batch Edit in the upper-right corner of the box. See Map multiple object names in bulk.

Click Next: Advanced Settings.

Step 5: Configure advanced settings

ParameterDescription
Dedicated Cluster for Task SchedulingBy default, DTS uses a shared cluster. To improve task stability, purchase a dedicated cluster. For details, see What is a DTS dedicated cluster?.
Retry Time for Failed ConnectionsIf the connection to the source or destination fails after the task starts, DTS retries immediately. The default retry duration is 720 minutes. Set a value between 10 and 1,440 minutes; 30 minutes or more is recommended. If the connection is restored within this period, the task resumes automatically.
Note

If multiple DTS instances share a source or destination, DTS uses the shortest configured retry duration for all instances. DTS charges for task runtime during retries—set a duration based on your business needs.

Retry Time for Other IssuesIf a non-connection issue occurs (such as a DDL or DML execution error), DTS retries immediately. The default retry duration is 10 minutes. Set a value between 1 and 1,440 minutes; 10 minutes or more is recommended.
Important

This value must be less than Retry Time for Failed Connections.

Enable Throttling for Full Data SynchronizationLimit the full data synchronization rate to reduce load on the source and destination databases. Set Queries per second (QPS) to the source database, RPS of Full Data Migration, and Data migration speed for full migration (MB/s). This parameter is available only when Full Data Synchronization is selected as a synchronization type. You can also adjust the rate while the task is running.
Enable Throttling for Incremental Data SynchronizationLimit the incremental synchronization rate to reduce load on the destination database. Set RPS of Incremental Data Synchronization and Data synchronization speed for incremental synchronization (MB/s).
Environment TagSelect an environment tag to identify the instance.
Configure ETLChoose whether to enable the extract, transform, and load (ETL) feature. Select Yesalert notifications to enter data processing statements in the code editor. For details, see Configure ETL in a data migration or data synchronization task. Select No to disable it. For an overview, see What is ETL?.
Monitoring and AlertingConfigure alerts to receive notifications when the synchronization fails or latency exceeds a threshold. Select Yes to set the alert threshold and contacts. For details, see Configure monitoring and alerting during task configuration.

Click Data Verification to configure a data verification task. For details, see Configure data verification.

Step 6: Save and run a precheck

Click Next: Save Task Settings and Precheck at the bottom of the page.

To view the API parameters for this configuration, hover over Next: Save Task Settings and Precheck and click Preview OpenAPI parameters in the tooltip.
Before a synchronization task starts, DTS runs a precheck. The task starts only if the precheck passes.
If the precheck fails, click View Details next to the failed item, fix the issue, and rerun the precheck.
For non-ignorable warnings, click View Details, fix the issue, and rerun the precheck. For ignorable warnings, click Confirm Alert Details > Ignore > OK, then click Precheck Again. Ignoring warnings may lead to data inconsistency—proceed with caution.

Step 7: Purchase the instance

  1. When the Success Rate reaches 100%, click Next: Purchase Instance.

  2. On the Purchase page, select the billing method and instance class.

    CategoryParameterDescription
    New Instance ClassBilling MethodSubscription: Pay upfront for a fixed duration. Cost-effective for long-term, continuous tasks. Pay-as-you-go: Billed hourly for actual usage. Suitable for short-term or test tasks—release the instance at any time to stop billing.
    Resource Group SettingsThe resource group for the instance. Defaults to default resource group. See What is Resource Management?.
    Instance ClassAffects the synchronization rate. Select a class based on your requirements. See Data synchronization link specifications.
    Subscription DurationFor Subscription billing, select the duration: 1–9 months or 1, 2, 3, or 5 years.
  3. Read and select the checkbox for Data Transmission Service (Pay-as-you-go) Service Terms.

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

Monitor the task progress on the data synchronization page.

After the task starts

Update sequence values in the destination database

After you switch your business to the destination instance, new sequences do not increment from the maximum value of the source sequence. Before the business cutover, update the sequence value in the destination database. For instructions, see Update the sequence value in the destination database.