All Products
Search
Document Center

Data Transmission Service:Configure one-way data synchronization between ApsaraDB RDS for PostgreSQL instances

Last Updated:Jul 10, 2026

Data Transmission Service (DTS) lets you sync data from one ApsaraDB RDS for PostgreSQL instance to another in real time. Use this workflow when you need disaster recovery standby instances, read replicas for read/write splitting, cross-account database migration, or a separate analytics instance that stays in sync with production.

DTS supports three synchronization phases — schema synchronization, full data synchronization, and incremental data synchronization — and four one-way topologies: one-to-one, one-to-many, cascade, and many-to-one.

Prerequisites

Before you begin, make sure you have:

  • Both the source and destination ApsaraDB RDS for PostgreSQL instances created. See Create an ApsaraDB RDS for PostgreSQL instance.

  • A destination instance version the same as or later than the source version. An older destination version can cause compatibility errors.

  • Enough free storage space on the destination instance — it must exceed the total data size in the source instance.

  • The wal_level parameter on the source instance set to logical.

  • WAL log retention configured as follows:

    • Incremental data synchronization only: retain WAL logs for more than 24 hours.

    • Full data synchronization + incremental data synchronization: retain WAL logs for at least seven days. After full data synchronization completes, you can reduce the retention period to more than 24 hours.

Important

If WAL logs are not retained long enough, DTS may fail to read them, causing the task to fail and potentially leading to data inconsistency or loss. Make sure that you set the retention period of WAL logs based on the preceding requirements. Otherwise, service reliability or performance in the Service Level Agreement (SLA) of DTS may not be guaranteed.

For supported source and destination version combinations, see Overview of data synchronization scenarios.

Billing

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

Limitations

Review these limitations before you start.

Source database requirements

  • Tables must have a PRIMARY KEY or UNIQUE constraint, with all fields unique. Without these constraints, the destination database may contain duplicate records.

    If you create the synchronization task without selecting Schema Synchronization, the destination table must have the same PRIMARY KEY or NOT NULL UNIQUE constraints as the source table. Otherwise, duplicate records may appear.
  • If you select tables as the synchronization objects and want to rename tables or columns in the destination, a single task supports a maximum of 5,000 tables. For more than 5,000 tables, split the workload across multiple tasks, or synchronize at the database level instead of the table level.

  • DTS cannot synchronize temporary tables, internal triggers, or certain internal procedures and functions written in C. DTS can synchronize custom parameters of the COMPOSITE, ENUM, and RANGE types. Tables must have PRIMARY KEY, FOREIGN KEY, UNIQUE, or CHECK constraints.

  • DTS creates a replication slot prefixed with dts_sync_ on the source database, giving DTS access to incremental logs from the past 15 minutes. Replication slots that accumulate can exhaust disk space. Set a disk usage alarm on the source instance when logical replication is active. Replication slot cleanup behavior: Amazon slot查询信息

    • After the DTS instance is released, the slot is deleted automatically — unless you changed the source database password or removed DTS IP addresses from the IP whitelist, in which case you must delete the slot manually.

    • If a primary/secondary switchover occurs on the source, log on to the secondary database and delete the slot manually.

  • DTS creates the following temporary tables in the source database to capture DDL statements, incremental table schemas, and heartbeat information. Do not delete them while synchronization is running — they are deleted 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

  • DTS adds a heartbeat table named dts_postgres_heartbeat to the source database to track synchronization latency accurately.

  • To perform a primary/secondary switchover on the source ApsaraDB RDS for PostgreSQL instance without interrupting synchronization, enable the Logical Replication Slot Failover feature first. See Logical Replication Slot Failover.

  • If a single incremental data change exceeds 256 MB, the running synchronization instance fails and cannot be recovered — you must reconfigure the task.

  • During schema synchronization and full data synchronization, do not execute DDL statements that change database or table schemas. The task will fail if you do.

  • If the source database has long-running transactions during incremental data synchronization, WAL logs generated before those transactions are committed may accumulate and exhaust disk space.

  • If a major version upgrade is performed on the source database while a synchronization instance is running, the instance fails and cannot be recovered — you must reconfigure the task.

Other requirements

  • A single task synchronizes data from one database only. To synchronize multiple databases, create a separate task for each.

  • DTS cannot synchronize tables that have inheritance relationships across schemas.

  • If you select a schema as the synchronization object, run the following statement before writing data to any new or renamed table in that schema:

    ALTER TABLE schema.table REPLICA IDENTITY FULL;

    Replace schema and table with the actual names. Run this statement during off-peak hours and avoid locking the table — locking it while running this statement can cause a deadlock.

  • DTS does not validate metadata such as sequences. Check sequence validity manually.

  • Before switching workloads to the destination database, update the starting value of sequences in the destination. After the switch, newly written sequences do not continue from the maximum value in the source.

  • When the destination account is a privileged or superuser account and synchronized tables contain foreign keys, triggers, or event triggers, DTS temporarily sets session_replication_role to replica at the session level. If the destination account lacks the required permissions, set this parameter to replica manually. Cascade UPDATE or DELETE operations on the source during this time may cause data inconsistency. After the task is released, set the parameter back to origin.

  • Writing data from other sources to the destination database during synchronization causes data inconsistency. For example, running online DDL statements from DMS while other sources write to the destination database may cause data loss.

  • If a task fails, DTS technical support will attempt to restore it within 8 hours. During restoration, the task may be restarted and task parameters (not database parameters) may be modified.

Requirements for specific source database types

ApsaraDB RDS for PostgreSQL source

Do not modify the endpoint or zone of the source instance while synchronization is running. This will cause the task to fail.

Self-managed PostgreSQL source

The values of max_wal_senders and max_replication_slots must each be greater than the sum of the number of replication slots currently in use and the number of DTS instances you plan to create for this database.

Cloud SQL for PostgreSQL (Google Cloud) source

Set Database Account to an account with the cloudsqlsuperuser permission. When selecting objects to synchronize, choose only objects the account is authorized to manage, or grant the OWNER permission on those objects to the account.

An account with cloudsqlsuperuser permission cannot manage data owned by other accounts with the same permission.

Supported objects

Object type Details
SCHEMA and TABLE Includes PRIMARY KEY, UNIQUE KEY, FOREIGN KEY, built-in data types, and DEFAULT constraints
VIEW, PROCEDURE, FUNCTION, RULE, SEQUENCE, EXTENSION, TRIGGER, AGGREGATE, INDEX, OPERATOR, DOMAIN PROCEDURE requires PostgreSQL V11 or later

SQL operations that can be synchronized

Type Statements
DML INSERT, UPDATE, DELETE
DDL See below

DDL synchronization is available only for tasks created after October 1, 2020.

Important

For tasks created before May 12, 2023, you must create triggers and functions in the source database to capture DDL information before configuring the task. See Use triggers and functions to implement incremental DDL migration for PostgreSQL databases.

DDL synchronization requires a privileged database account on the source instance with a minor engine version of 20210228 or later. To update the minor version, see Update the minor engine version.

Supported DDL statements:

  • CREATE TABLE and DROP TABLE

  • ALTER TABLE: RENAME TABLE, ADD COLUMN, ADD COLUMN DEFAULT, ALTER COLUMN TYPE, DROP COLUMN, ADD CONSTRAINT, ADD CONSTRAINT CHECK, ALTER COLUMN DROP DEFAULT

  • TRUNCATE TABLE (source self-managed PostgreSQL version 11 or later only)

  • CREATE INDEX ON TABLE

DDL limitations:

  • To use a data synchronization task created before May 12, 2023 to synchronize DDL operations, you must create triggers and functions in the source database to capture DDL information before you configure the data synchronization task. For more information, see Use triggers and functions to implement incremental DDL migration for PostgreSQL databases.

  • BIT type data cannot be synchronized during incremental data synchronization.

  • Additional DDL clauses such as CASCADE or RESTRICT are not synchronized.

  • DDL statements from sessions that execute SET session_replication_role = replica are not synchronized.

  • DDL statements executed by invoking functions are not synchronized.

  • If a transaction contains both DML and DDL statements, the DDL statements are not synchronized.

  • DDL statements for objects outside the synchronization scope are not synchronized.

Create a synchronization task

Step 1: Open the data synchronization page

Use either the DTS console or the DMS console.

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 resides.

DMS console

Note The steps may vary depending on the DMS console mode and layout. 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: Create the task

  1. Click Create Task.

  2. If the page shows a New Configuration Page button in the upper-right corner, click it.

    Skip this step if Back to Previous Version is shown instead. The new and previous configuration pages may differ slightly — use the new version.

Step 3: Configure source and destination databases

Warning

After configuring both databases, read the Limits displayed on the page. Skipping this may cause the task to fail or result in data inconsistency.

Section

Parameter

Description

N/A

Task Name

DTS automatically generates a task name. We recommend that you specify a descriptive name for easy identification. The name does not need to be unique.

Source Database

Database Type

The type of the source database. Select PostgreSQL.

Connection Type

The access method of the source database. Select Alibaba Cloud Instance.

Instance Region

The region in which the source ApsaraDB RDS for PostgreSQL instance resides.

Replicate Data Across Alibaba Cloud Accounts

For this example, select No, as the database instance belongs to the current Alibaba Cloud account.

Instance ID

The ID of the source ApsaraDB RDS for PostgreSQL instance.

Database Name

The name of the database from which objects are synchronized in the source ApsaraDB RDS for PostgreSQL instance.

Database Account

The database account of the source ApsaraDB RDS for PostgreSQL instance. Specify a privileged account that is the owner of the database. For more information about how to create an account for an ApsaraDB RDS for PostgreSQL instance and grant permissions to the account, see Create an account and Create a database.

Note

If the source instance is an ApsaraDB RDS for PostgreSQL V9.4 instance and you want to synchronize only DML operations, only the REPLICATION permission is required for the database account.

Database Password

Enter the password for the specified database account.

Encryption

Specifies whether to encrypt the connection to the source database. You can configure this parameter based on your business requirements. In this example, Non-encrypted is selected.

If you want to establish an SSL-encrypted connection to the source database, perform the following steps: Select SSL-encrypted, upload CA Certificate, Client Certificate, and Private Key of Client Certificate as needed, and then specify Private Key Password of Client Certificate.

Note
  • If you set Encryption to SSL-encrypted for a self-managed PostgreSQL database, you must upload CA Certificate.

  • If you want to use the client certificate, you must upload Client Certificate and Private Key of Client Certificate and specify Private Key Password of Client Certificate.

  • For information about how to configure SSL encryption for an ApsaraDB RDS for PostgreSQL instance, see SSL encryption.

Destination Database

Database Type

The type of the destination database. Select PostgreSQL.

Connection Type

The access method of the destination database. Select Alibaba Cloud Instance.

Instance Region

The region in which the destination ApsaraDB RDS for PostgreSQL instance resides.

Instance ID

The ID of the destination ApsaraDB RDS for PostgreSQL instance.

Database Name

The name of the database to which objects are synchronized in the destination ApsaraDB RDS for PostgreSQL instance.

Database Account

The database account of the destination ApsaraDB RDS for PostgreSQL instance. The account must have the owner permissions on schemas. For information about how to create an account for an ApsaraDB RDS for PostgreSQL instance and grant permissions to the account, see Create an account.

Database Password

Enter the password for the specified database account.

Encryption

Specifies whether to encrypt the connection to the source database. You can configure this parameter based on your business requirements. In this example, Non-encrypted is selected.

If you want to establish an SSL-encrypted connection to the source database, perform the following steps: Select SSL-encrypted, upload CA Certificate, Client Certificate, and Private Key of Client Certificate as needed, and then specify Private Key Password of Client Certificate.

Note
  • If you set Encryption to SSL-encrypted for a self-managed PostgreSQL database, you must upload CA Certificate.

  • If you want to use the client certificate, you must upload Client Certificate and Private Key of Client Certificate and specify Private Key Password of Client Certificate.

  • For information about how to configure SSL encryption for an ApsaraDB RDS for PostgreSQL instance, see SSL encryption.

Step 4: Test connectivity

Click Test Connectivity and Proceed at the bottom of the page.

DTS server CIDR blocks must be added to the security settings of both databases. See Add the CIDR blocks of DTS servers. If either database is self-managed and not set to Alibaba Cloud Instance access, click Test Connectivity in the CIDR Blocks of DTS Servers dialog.

Step 5: Configure objects to synchronize

In the Configure Objects step, set the following parameters:

Parameter Description
Synchronization Types Incremental Data Synchronization is selected by default. Also select Schema Synchronization and Full Data Synchronization to sync historical data as the baseline for incremental sync. Selecting Schema Synchronization causes DTS to sync table schemas, including foreign keys.
Synchronization Topology Select One-way Synchronization.
Processing Mode of Conflicting Tables Precheck and Report Errors (default): the precheck fails if the source and destination have tables with the same name. Use object name mapping to rename conflicting tables in the destination if needed. Ignore Errors and Proceed: skips the name conflict check. During full sync, existing destination records with matching primary or unique key values are kept. During incremental sync, they are overwritten. If schemas differ, initialization may partially fail. Use with caution.
Capitalization of Object Names in Destination Instance Controls how database, table, and column names are capitalized in the destination. Default is DTS default policy. See Specify the capitalization of object names.
Source Objects Select columns, tables, or schemas and click the arrow icon to move them to Selected Objects.
Selected Objects Right-click an object to rename it (see Map the name of a single object), filter by SQL operation, or add WHERE conditions (see Set filter conditions). To rename multiple objects at once, click Batch Edit. Note that renaming an object may break synchronization for dependent objects.

Step 6: Configure advanced settings

Click Next: Advanced Settings and configure the following:

Parameter Description
Dedicated Cluster for Task Scheduling By default, DTS uses a shared cluster. For higher task stability, purchase a dedicated cluster. See What is a DTS dedicated cluster.
Retry Time for Failed Connections How long DTS retries after a connection failure. Valid range: 10–1440 minutes. Default: 720 minutes. Set to at least 30 minutes. If DTS reconnects within this window, the task resumes; otherwise the task fails. If multiple tasks share the same source or destination, the shortest retry time applies. DTS instance charges continue during retries.
Retry Time for Other Issues How long DTS retries after DDL or DML failures. Valid range: 1–1440 minutes. Default: 10 minutes. Set to at least 10 minutes. This value must be smaller than Retry Time for Failed Connections.
Enable Throttling for Full Data Migration Limit QPS to the source database, RPS of full data migration, or migration speed (MB/s) to reduce load during full sync. Visible only when Full Data Synchronization is selected.
Enable Throttling for Incremental Data Synchronization Limit RPS or synchronization speed (MB/s) for incremental sync to reduce load on the destination.
Environment Tag An optional tag to identify the DTS instance.
Configure ETL Enable the extract, transform, and load (ETL) feature to transform data in transit. Select Yesalert notification settings to enter data processing statements. See Configure ETL in a data migration or data synchronization task.
Monitoring and Alerting Set up alerts for task failures or latency exceeding a threshold. Select Yes to configure the alert threshold and notification contacts. See Configure monitoring and alerting when you create a DTS task.

Step 7: Configure data verification (optional)

Click Next Step: Data Verification to set up verification. See Configure a data verification task.

Step 8: Run the precheck

Click Next: Save Task Settings and Precheck.

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

DTS runs a precheck before the task can start. If the precheck fails:

  • Click View Details next to each failed item, resolve the issue, then click Precheck Again.

  • If an item shows an alert that can be ignored, click Confirm Alert Details > Ignore > OK, then click Precheck Again. Ignoring alerts may lead to data inconsistency.

Step 9: Purchase and start the instance

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

  2. On the purchase page, configure the following:

    Section

    Parameter

    Description

    New Instance Class

    Billing Method

    • Subscription: You pay for a subscription when you create a data synchronization instance. The subscription billing method is more cost-effective than the pay-as-you-go billing method for long-term use.

    • Pay-as-you-go: A pay-as-you-go instance is billed on an hourly basis. The pay-as-you-go billing method is suitable for short-term use. If you no longer require a pay-as-you-go data synchronization instance, you can release the instance to reduce costs.

    Resource Group Settings

    The resource group to which the data synchronization instance belongs. Default value: default resource group. For more information, see What is Resource Management?

    Instance Class

    DTS provides instance classes that vary in synchronization speed. You can select an instance class based on your business requirements. For more information, see Instance classes of data synchronization instances.

    Subscription Duration

    If you select the subscription billing method, specify the subscription duration and the number of data synchronization instances that you want to create. The subscription duration can be one to nine months, one year, two years, three years, or five years.

    Note

    This parameter is available only if you select the Subscription billing method.

  3. Read and accept Data Transmission Service (Pay-as-you-go) Service Terms.

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

View the task progress in the task list.

What to do after the task starts

After the task starts, monitor synchronization latency in the task list. Before switching workloads to the destination:

  • Update the starting value of sequences in the destination database. After the switch, new sequence values will not continue from the maximum value in the source.

  • If you use only DTS to write table data to the destination database, you can use DMS to perform online DDL operations on source tables without locking them during synchronization. See Change schemas without locking tables.

For supported synchronization topologies, see Synchronization topologies.