SQL Replay

Updated at:

After migrating data from a source OLTP database to a target OLAP database, use the SQL Replay feature in Data Management Service (DMS) to check SQL compatibility and compare performance. This feature improves testing efficiency for your OLAP database.

Background

OLTP is a primary use case for traditional relational databases, handling basic, day-to-day transactions such as those in order transaction systems.

OLAP is the primary use case for data warehouse systems, supporting complex analytical operations and decision support with real-time analysis.

Prerequisites

  • You have migrated data from the OLTP database (RDS for MySQL or PolarDB for MySQL) to the OLAP database (AnalyticDB for MySQL) using the data migration feature of Data Transmission Service (DTS). For more information, see Migration solution overview.

  • DAS Professional Edition is enabled for the source instance. For more information, see Manage DAS audit logs and O&M services (formerly Economic Edition).

  • The source database (RDS for MySQL or PolarDB for MySQL) and the target database (AnalyticDB for MySQL) have been added to DMS.

Procedure

  1. Log in to DMS 5.0.

  2. In the top navigation bar, choose Solutions > SQL Replay.

    Note

    If you are using the streamlined console, click the 2023-01-28_15-57-17.png icon in the upper-left corner of the console and choose All functions > Solutions > SQL Replay.

  3. In the upper-right corner, click SQL Replay, configure the ticket parameters, and then click Submit ticket.

    Parameter

    Description

    Task name

    Enter a clear, specific task name to reduce communication overhead.

    Database type

    Only RDS for MySQL and PolarDB for MySQL are supported as source database types.

    Source instance

    Select the MySQL instance.

    Select database for replay

    This switch is disabled by default.

    • If this switch is disabled, the feature replays SQL statements from the entire source instance.

    • If this switch is enabled, the feature replays only database-level SQL statements. The database refers to the one that the session was connected to when the source SQL was executed.

    AnalyticDB for MySQL instance

    Select the target instance from the drop-down list.

    Traffic to replay

    Select a time range for the SQL replay. You can replay up to 30 days of SQL activity.

    Note

    The selected time range must be shorter than the log retention period configured in SQL Insight for the source instance.

  4. In the Execution area, check if the SQL from the source database executes successfully in AnalyticDB for MySQL. If the execution fails, this indicates potential compatibility issues between the source and target, and you must modify the SQL in the target database. Compare the SQL execution time on the source database with the execution time on the target database.

    Click the SQL performance comparison tab. The top of the page displays a summary of the number of sql templates with improved or degraded performance. The table below lists the Average execution duration on the source and Average execution duration on the target (in milliseconds) for each sql template, allowing you to compare the performance of each one.

Next steps

If you need to modify SQL statements after using the SQL Replay feature, you can do so in the SQL Console. For more information, see SQL Console.