All Products
Search
Document Center

Data Transmission Service:Migrate RDS for PostgreSQL to RDS for MySQL

Last Updated:Jul 10, 2026

Use Data Transmission Service (DTS) to migrate data from an ApsaraDB RDS for PostgreSQL instance to an ApsaraDB RDS for MySQL instance. DTS supports both full and incremental data migration for zero-downtime database migration.

Source and destination databases

DTS supports PostgreSQL-to-MySQL migration in the following scenarios. This topic uses ApsaraDB RDS for PostgreSQL instance to an ApsaraDB RDS for MySQL instance as an example.

  • Migrate data from an ApsaraDB RDS for PostgreSQL instance to an ApsaraDB RDS for MySQL instance.

  • Migrate data from a self-managed PostgreSQL database to a self-managed MySQL database.

Prerequisites

Limitations

Note
  • During schema migration, DTS migrates foreign keys from the source database to the destination database.

  • During full data migration and incremental data migration, DTS temporarily disables constraint checks and foreign key cascading operations at the session level. If cascading update or delete operations occur in the source database while the task is running, data inconsistency can occur.

Type

Description

Source database limitations

  • The server that hosts the source database must have sufficient outbound bandwidth. Insufficient bandwidth can affect the migration speed.

  • Each table to be migrated must have a primary key or a unique constraint. All fields in the key or constraint must be unique to prevent duplicate data in the destination database.

  • If you migrate objects at the table level and need to perform edits such as column name mapping, a single migration task supports a maximum of 1,000 tables. If you exceed this limit, an error is reported when you submit the task. In this case, you can split the tables into multiple tasks or configure a task to migrate the entire database.

  • For incremental migration, you must configure write-ahead logging (WAL):

    • The WAL feature must be enabled.

    • For an incremental migration-only task, Data Transmission Service (DTS) requires the WAL logs of the source database to be retained for at least 24 hours. For a task that includes both full and incremental migration, DTS requires the logs to be retained for at least 7 days. You can change the retention period back to at least 24 hours after the full migration is complete. Setting a shorter retention period can cause the task to fail if DTS cannot obtain the required WAL logs, potentially leading to data inconsistency or data loss. The DTS Service Level Agreement (SLA) does not cover issues caused by a WAL retention period shorter than the requirement.

  • Operational limitations on the source database:

    • During the schema migration and full data migration phases, do not perform any DDL operations that alter the schema of databases or tables. Otherwise, the migration task will fail.

    • If you perform only full data migration, do not write new data to the source instance to avoid data inconsistency. To maintain real-time data consistency, we recommend selecting schema migration, full data migration, and incremental data migration.

    • To ensure the migration task runs smoothly and to prevent logical subscription interruptions caused by a primary/secondary switchover, the source PolarDB for PostgreSQL(Compatible with Oracle) cluster must support logical replication slot failover and have it enabled.

      Note

      If the source PolarDB for PostgreSQL(Compatible with Oracle) cluster does not support logical replication slot failover (for example, if the cluster's database engine is Oracle syntax compatibility 2.0), a high-availability (HA) switchover on the source database can cause the migration instance to fail and become unrecoverable.

    • Due to the limitations of logical subscriptions, if a migration instance that includes incremental data migration is running and the size of a single row to be migrated exceeds 256 MB after an incremental change, the migration instance fails irrecoverably, and you must reconfigure it.

  • If long-running transactions exist in the source database during an incremental migration, write-ahead logging (WAL) records generated before these transactions commit cannot be cleared. This can cause WAL files to accumulate and exhaust the disk space of the source database.

Other limitations

  • A single data migration task can migrate only one database. To migrate multiple databases, you must configure a separate migration task for each one.

  • DTS does not support migrating TimescaleDB extension tables, tables with cross-schema inheritance, or tables with expression-based unique indexes.

  • These schemas will not be visible in the console when you configure the task.

  • If a table to be migrated contains a column of the SERIAL type, a sequence is automatically created for that column in the source database. Therefore, when you configure Source Objects, if the Migration Types includes Schema Migration, we recommend that you also select Sequence or migrate the entire schema. Otherwise, the migration instance may fail.

  • For tasks that include incremental data migration, you must run the ALTER TABLE schema.table REPLICA IDENTITY FULL; command on the tables to be migrated in the source database before you write data to them. This ensures data consistency for the tables in the following two scenarios. To prevent deadlocks, avoid table-locking operations while this command runs. If you skip the related checks during the precheck, DTS automatically runs this command when it initializes the instance.

    • When the instance runs for the first time.

    • When the migration object granularity is set to Schema and a new table is created in the schema or an existing table is rebuilt by using the RENAME command.

    Note
    • In the command, replace schema and table with the schema name and table name of the data to be migrated.

    • Perform this operation during off-peak hours.

  • DTS creates the following temporary tables in the source database to obtain information such as DDL statements for incremental data, the structure of incremental tables, and heartbeats. Do not delete these temporary tables during the migration, as this will cause the task to fail. The tables are automatically deleted after 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.

  • To ensure the accuracy of latency metrics for incremental data migration, DTS creates a heartbeat table named dts_postgres_heartbeat in the source database.

  • During incremental data migration, DTS creates a replication slot prefixed with dts_sync_ in the source database to replicate data. This replication slot allows DTS to obtain incremental logs from the source database from the last 15 minutes. When a data migration task fails or the migration instance is released, DTS attempts to automatically clean up the replication slot.

    Note
    • If you change the password of the source database account used by the task or remove the DTS IP addresses from the IP address whitelist of the source database during migration, the replication slot cannot be automatically cleaned up. In this case, you must manually clean up the replication slot in the source database to prevent log accumulation, which can exhaust disk space and cause the source database to become unavailable.

    • If a primary/secondary switchover occurs on the source database, you must log on to the secondary database to manually clean up the replication slot.

  • Before you start the migration, evaluate the performance of both the source and destination databases. We recommend that you run the migration during off-peak hours. During full data migration, DTS consumes read and write resources on both databases, which can increase their load.

  • Concurrent INSERT operations during full data migration can cause table fragmentation, which may result in the destination database using more storage space than the source instance.

  • Verify that the migration precision for columns of the FLOAT or DOUBLE data types meets your business requirements. DTS uses the ROUND(COLUMN,PRECISION) function to read values from these columns. If a precision is not explicitly defined, DTS uses a precision of 38 for FLOAT and 308 for DOUBLE.

  • DTS attempts to resume a failed migration task for up to seven days. Before you switch business workloads to the destination instance, you must end or release the task, or revoke the write permissions of the account that DTS uses to access the destination instance by using the revoke command. This prevents an automatically resumed task from overwriting data in the destination instance.

  • DTS validation checks data content but does not support metadata validation for objects such as sequences. You must validate these objects manually.

  • After you switch your workloads to the destination instance, newly written sequences do not increment from the maximum value of the corresponding sequences in the source database. Before you switch your workloads, you must update the sequence values in the destination database. For more information, see Update sequence values in the destination database.

  • This limit applies to full or incremental data migration tasks where the tables to be migrated from the source database contain foreign keys, triggers, or event triggers. If the destination database account has high-privilege or superuser permissions, DTS temporarily sets the session_replication_role parameter to replica at the session level during the migration. If the account does not have these permissions, you must manually set the parameter to replica in the destination database. During this period (while session_replication_role is set to replica), cascade update or delete operations in the source database may cause data inconsistency. After the migration task is released, you can set the parameter back to origin.

  • If a task fails, DTS support staff will attempt to restore it within eight hours. During restoration, they may restart the task or adjust its parameters.

    Note

    Only DTS task parameters are modified—not database parameters. Parameters that may be adjusted include those listed in Modify instance parameters.

  • When migrating partitioned tables, you must include the parent table and all its child partitions as migration objects to prevent data inconsistency.

    Important
    • In PolarDB for PostgreSQL(Compatible with Oracle), the parent table of a partitioned table does not store data directly. Data is stored in the child partitions. The migration task must include the parent table and all its child partitions to prevent data loss and inconsistency between the source and destination databases.

    • Migration of partitioned tables or inherited tables (parent and child tables) that are distributed across different databases is not supported. Ensure that the partitioned tables and all their partitions, as well as parent tables and all their child tables, are in the same database.

Pricing

Migration type

Link configuration fee

Public network traffic fee

Structure migration and full data migration

No charge.

Charges apply to data migrated from Alibaba Cloud over the public network. For more information, see Billing overview.

Incremental data migration

Charges apply. For more information, see Billing overview.

Migration types

  • Schema migration

    Data Transmission Service (DTS) migrates the schema definitions of the migration objects from the source database to the destination database.

    • DTS supports schema migration for tables, views, triggers, stored procedures, and functions.

      Note

      The routine_body of stored procedures, the routine_body of functions, and the select_statement of views are not modified.

    • During schema migration, DTS changes the `DEFINER` to `INVOKER` for the views, stored procedures, and functions to be migrated. This action changes the value of `SQL SECURITY` to `INVOKER`. DTS also sets the `DEFINER` to the destination database account that is used for the migration task.

      Note

      The security authentication method and definer of the source database are not modified.

    • Because DTS does not migrate user information, you must grant read and write permissions to the invoker to call views, stored procedures, and functions in the destination database.

  • Full migration

    DTS migrates all historical data of the specified migration objects from the source database to the destination database.

  • Incremental migration

    After a full migration is complete, DTS migrates incremental data updates from the source database to the destination database. Incremental migration lets you smoothly migrate data without interrupting your self-managed applications.

SQL operations for incremental migration

Operation type

SQL statement

DML

INSERT, UPDATE, and DELETE

Permission requirements for database accounts

Database

Full data migration

Incremental data migration

Actions

ApsaraDB RDS for PostgreSQL instance

SELECT permission on the objects to migrate.

A privileged account that owns the selected database.

Note

For incremental DML migration from an ApsaraDB RDS for PostgreSQL 9.4 source instance, only REPLICATION permission is required.

Create an account and create a database.

ApsaraDB RDS for MySQL instance

Read and write permissions

Create an account and modify account permissions.

Procedure

  1. Navigate to the migration task list page for the destination region using one of the following methods.

    From the DTS console

    1. Log on to the Data Transmission Service (DTS) console.

    2. In the navigation pane on the left, click Data Migration.

    3. In the upper-left corner of the page, select the region where the migration instance is located.

    From the DMS console

    Note

    The actual operations may vary based on the mode and layout of the DMS console. For more information, see Simple mode console and Customize the layout and style of the DMS console.

    1. Log on to the Data Management (DMS) console.

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

    3. To the right of Data Migration Tasks, select the region where the migration instance is located.

  2. Click Create Task to navigate to the task configuration page.

  3. Optional: In the upper-right corner of the page, click New Configuration Page.

    Note
    • If you are already on the new configuration page (the button in the upper-right corner is Back to Previous Version), you can skip this step.

    • The parameters on the new and old configuration pages are different. We recommend that you use the new configuration page.

  4. Configure the source and destination databases.

    Warning

    After you select the source and destination instances, read the Limits at the top of the page to ensure that the migration task can be created and run successfully.

    Category

    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

    Select PostgreSQL.

    Connection Type

    Select Alibaba Cloud Instance.

    Instance Region

    Select the region of the source ApsaraDB RDS for PostgreSQL instance.

    Instance ID

    Select the instance ID of the source ApsaraDB RDS for PostgreSQL instance.

    Database Name

    Enter the name of the source database in the ApsaraDB RDS for PostgreSQL instance that contains the objects to migrate.

    Database Account

    Enter the database account for the source ApsaraDB RDS for PostgreSQL instance. The required permissions are listed in Permission requirements for database accounts.

    Database Password

    Enter the password for the database account.

    Encryption

    Select a connection method. In this example, Non-encrypted is selected.

    If you need to connect to the database by using SSL encryption, select SSL-encrypted, and then upload the CA Certificate, Client Certificate, and Private Key of Client Certificate as needed. Then, enter the Private Key Password of Client Certificate.

    Note
    • If you select SSL-encrypted for a self-managed PostgreSQL database, you must upload the CA Certificate.

    • If you need to use a client certificate, you must upload both the Client Certificate and the Private Key of Client Certificate, and then enter the Private Key Password of Client Certificate.

    • For information about the SSL encryption feature for an RDS for PostgreSQL instance, see SSL connection encryption.

    Destination Database

    Database Type

    Select MySQL.

    Connection Type

    Select Alibaba Cloud Instance.

    Instance Region

    Select the region of the destination ApsaraDB RDS for MySQL instance.

    RDS Instance ID

    Select the instance ID of the destination ApsaraDB RDS for MySQL instance.

    Database Account

    Enter the database account for the destination ApsaraDB RDS for MySQL instance. The required permissions are listed in Permission requirements for database accounts.

    Database Password

    Enter the password for the database account.

    Connection Method

    Select Non-encrypted or SSL-encrypted based on your database requirements. If you set this parameter to SSL-encrypted, you must enable SSL encryption for the RDS for MySQL instance beforehand. For more information, see Quickly enable SSL encryption using a cloud certificate.

  5. After you have completed the configuration, click Test Connectivity and Proceed at the bottom of the page.

    Note
    • Ensure that the IP address CIDR blocks of DTS servers are added to the security settings of the source and destination databases to allow access from DTS servers. This can be done automatically or manually. For more information, see Add the IP address CIDR blocks of DTS servers to a whitelist.

    • If the source or destination database is a self-managed database (where the Access Method is not Alibaba Cloud Instance), you must also click Test Connectivity in the CIDR Blocks of DTS Servers dialog box.

  6. Configure the task objects.

    1. On the Configure Objects page, configure the objects that you want to migrate.

      Parameter

      Description

      • If you only need to perform a full migration, select both Schema Migration and Full Data Migration.

      • To perform a migration with no downtime, select Schema Migration, Full Data Migration, and Incremental Data Migration.

      Note
      • If you do not select Schema Migration, you must ensure that a database and tables to receive the data exist in the destination database. You can also use the object name mapping feature in the Selected Objects box as needed.

      • If you do not select Incremental Data Migration, do not write new data to the source instance during data migration to ensure data consistency.

      Processing Mode of Conflicting Tables

      • Precheck and Report Errors: Checks whether tables with the same names exist in the destination database. If no tables with the same names exist, the precheck is passed. If tables with the same names exist, an error is reported during the precheck, and the data migration task does not start.

        Note

        If a table in the destination database has the same name but cannot be easily deleted or renamed, you can change the name of the table in the destination database. For more information, see Object name mapping.

      • Ignore Errors and Proceed: Skips the check for tables with the same names.

        Warning

        Selecting Ignore Errors and Proceed may cause data inconsistency and business risks. For example:

        • If the table schemas are consistent and a record in the destination database has the same primary key value as a record in the source database:

          • During full migration, DTS keeps the record in the destination database. The record from the source database is not migrated.

          • During incremental migration, DTS does not keep the record in the destination database. The record from the source database overwrites the record in the destination database.

        • If the table schemas are inconsistent, only some columns of data may be migrated, or the migration may fail. Proceed with caution.

      Source Objects

      In the Source Objects pane, select the objects that you want to synchronize, and then click 向右小箭头 to move them to the Selected Objects pane.

      Note

      The granularity for selecting migration objects is schema, table, and column. If you select only tables or columns as migration objects, other objects such as views, triggers, and stored procedures are not migrated to the destination database.

      Selected Objects

      Note
      • Object name mapping may cause migration failures for dependent objects.

      • To filter data with a WHERE clause, right-click a table in the Selected Objects section and specify the filter condition. Set filter conditions.

      • To select SQL operations for migration at the database or table level, right-click the migration object in the Selected Objects section and select the operations.

    2. Click Next: Advanced Settings to configure advanced parameters.

      Parameter

      Description

      Dedicated Cluster for Task Scheduling

      By default, DTS schedules tasks on a shared cluster. You do not need to select one. If you want more stable tasks, you can purchase a dedicated cluster to run DTS migration tasks.

      Retry Time for Failed Connections

      After the migration task starts, if the connection to the source or destination database fails, DTS reports an error and immediately begins to retry the connection. The default retry duration is 720 minutes. You can customize the retry time to a value from 10 to 1440 minutes. We recommend that you set the duration to more than 30 minutes. If DTS reconnects to the source and destination databases within the specified duration, the migration task automatically resumes. Otherwise, the task fails.

      Note
      • For multiple DTS instances that share the same source or destination, the network retry time is determined by the setting of the last created task.

      • Because you are charged for the task during the connection retry period, we recommend that you customize the retry time based on your business needs, or release the DTS instance as soon as possible after the source and destination database instances are released.

      Retry Time for Other Issues

      After the migration task starts, if a non-connectivity issue, such as a DDL or DML execution exception, occurs in the source or destination database, DTS reports an error and immediately begins to retry the operation. The default retry duration is 10 minutes. You can customize the retry time to a value from 1 to 1440 minutes. We recommend that you set the duration to more than 10 minutes. If the related operations succeed within the specified retry duration, the migration task automatically resumes. Otherwise, the task fails.

      Important

      The value of Retry Time for Other Issues must be less than the value of Retry Time for Failed Connections.

      Enable Throttling for Full Data Migration

      During full migration, DTS consumes read and write resources on the source and destination databases, which may increase the database load. If required, you can enable throttling for the full migration task. You can set Queries per second (QPS) to the source database, RPS of Full Data Migration, and Data migration speed for full migration (MB/s) to reduce the load on the destination database.

      Note
      • This configuration item is available only if you select Full Data Migration for Migration Types.

      • You can also adjust the full migration speed after the migration instance is running.

      Enable Throttling for Incremental Data Migration

      If required, you can also choose to set speed limits for the incremental migration task. You can set RPS of Incremental Data Migration and Data migration speed for incremental migration (MB/s) to reduce the load on the destination database.

      Note
      • This configuration item is available only if you select Incremental Data Migration for Migration Types.

      • You can also adjust the incremental migration speed after the migration instance is running.

      Environment Tag

      Optional. Select environment tags to identify the instance.

      Configure ETL

      Based on your business needs, select whether to configure the ETL feature to process data.

      • Yes: Configures the ETL feature. You must also enter data processing statements in the text box.

      • No: Does not configure the ETL feature.

      Monitoring and Alerting

      Select whether to set alerts and receive alert notifications based on your business needs.

      • No: Does not set an alert.

      • Yes: Configure alerts by setting an alert threshold and an alert notifications. If a migration fails or the latency exceeds the threshold, the system sends an alert notification.

    3. Click Next: Data Validation to configure a data validation task.

      If you want to use the data validation feature, see Configure data validation for configuration instructions.

  7. Save the task and run a precheck.

    • To view the parameters for configuring this instance when you call the API operation, move the pointer over the Next: Save Task Settings and Precheck button and click Preview OpenAPI parameters in the bubble that appears.

    • If you do not need to view or have finished viewing the API parameters, click Next: Save Task Settings and Precheck at the bottom of the page.

    Note
    • Before the migration task starts, DTS performs a precheck. The task starts only after it passes the precheck.

    • If the precheck fails, click View Details next to the failed check item, fix the issue based on the prompt, and then run the precheck again.

    • If a warning is reported during the precheck:

      • For check items that cannot be ignored, click View Details next to the failed item, fix the issue based on the prompt, and then run the precheck again.

      • For check items that can be ignored, you can click Confirm Alert Details, Ignore, OK, and Precheck Again to skip the alert item and run the precheck again. If you choose to ignore a warning, it may cause issues such as data inconsistency and pose risks to your business.

  8. Purchase an instance.

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

    2. On the Purchase page, select the link specification for the data migration instance. For more information, see the following table.

      Category

      Parameter

      Description

      New Instance Class

      Resource Group Settings

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

      Instance Class

      DTS provides migration specifications with different performance levels. The link specification affects the migration speed. You can select a specification based on your business scenario. For more information, see Data migration link specifications.

    3. After the configuration is complete, read and select Data Transmission Service (Pay-as-you-go) Service Terms.

    4. Click Buy and Start. In the OK dialog box that appears, click OK.

      You can view the progress of the migration task on the Data Migration Tasks list page.

      Note
      • If the migration task does not include incremental migration, it stops automatically after the full migration is complete. After the task stops, its Status changes to Completed.

      • If the migration task includes incremental migration, it does not stop automatically. The incremental migration task continues to run. While the incremental migration task is running, the Status of the task is Running.