All Products
Search
Document Center

ApsaraDB RDS:RDS MySQL lock analysis

Last Updated:Mar 30, 2026

The deadlock analysis feature helps you identify and resolve lock-related issues on an ApsaraDB RDS for MySQL instance. Use it to investigate a deadlock that just occurred, monitor deadlock trends over time, or diagnose live metadata locks and transaction blocking.

Prerequisites

Before you begin, ensure that you have:

  • An RDS instance running one of the following MySQL versions and editions:

    • MySQL 8.0 on RDS High-availability Edition, RDS Enterprise Edition, or RDS Cluster Edition, RDS Enterprise Edition,

    • MySQL 5.7 on RDS High-availability Edition, RDS Enterprise Edition, or RDS Cluster Edition, RDS Enterprise Edition,

    • MySQL 5.6 on RDS High-availability Edition

    • MySQL 5.5 on RDS High-availability Edition

RDS Basic Edition instances do not support this feature. To verify your instance version and edition, go to the Basic Information page in the ApsaraDB RDS console and check the Type and Edition, RDS Enterprise Edition, and Database Engine fields.
  • The required parameters configured for the analysis type you plan to use. See Required parameters.

How it works

The deadlock analysis feature has three sub-features. Choose based on your scenario:

Sub-feature When to use Data source
Recent Deadlock Analysis A deadlock just occurred and you need to investigate it immediately Latest deadlock log from SHOW ENGINE INNODB STATUS
Full Deadlock Analysis You want to monitor deadlock trends or investigate recurring deadlocks over a time range Error logs, parsed at regular intervals
Other Deadlock Analysis You need to diagnose live metadata locks or transaction blocking in current sessions Real-time data from information_schema and performance_schema

Full Deadlock Analysis and Other Deadlock Analysis require Database Autonomy Service (DAS) Cost-efficient Edition or DAS Enterprise Edition, which are available only in some regions. For supported regions, see Supported databases and regions. To enable a DAS edition, see Enable DAS Cost-efficient Edition and DAS Enterprise Edition.

Recent Deadlock Analysis

DAS analyzes the latest deadlock log from the output of SHOW ENGINE INNODB STATUS. If multiple deadlocks have occurred, only the most recent one is analyzed. Use this sub-feature for immediate post-incident investigation.

Full Deadlock Analysis

DAS parses error logs at regular intervals to extract deadlock information. Use this sub-feature to view deadlock trends and drill into the details of each deadlock within a specified time range — useful for identifying patterns or recurring issues before they escalate.

Other Deadlock Analysis

DAS analyzes the current sessions of your RDS instance in real time:

  • Metadata lock analysis: Deduces the lock wait relationship and generates a diagram based on data in information_schema.processlist.

  • Transaction blocking analysis: Analyzes the transaction blocking relationship and generates a diagram based on data in information_schema.processlist and information_schema.innodb_trx.

    • MySQL 5.6 and 5.7: uses information_schema.innodb_lock_waits

    • MySQL 8.0: uses performance_schema.data_lock_waits

Required parameters

Configure the required parameters before using each sub-feature. To modify instance parameters, see Modify instance parameters.

Sub-feature Required parameters
Recent Deadlock Analysis Enable innodb_deadlock_detect
Full Deadlock Analysis Enable innodb_deadlock_detect; enable innodb_print_all_deadlocks; set log_error_verbosity to 3
Transaction blocking analysis (Other Deadlock Analysis, MySQL 8.0 only) Enable performance_schema

Limitations

The deadlock analysis feature cannot analyze deadlocks that contain the following message:

TOO DEEP OR LONG SEARCH IN THE LOCK TABLE WAITS-FOR GRAPH, WE WILL ROLL BACK FOLLOWING TRANSACTION

Run deadlock analysis

  1. Go to the Instances page. In the top navigation bar, select the region where your RDS instance resides. Find the instance and click its ID.

  2. In the left-side navigation pane, choose Autonomy Services > Diagnostics.

  3. Click the Deadlock Analysis tab.

  4. Click Diagnose in the upper-left corner.

  5. Find the generated deadlock entry and click View Details in the Details column.

  6. On the Lock Analysis page, select the analysis type based on your scenario:

    • Recent Deadlock Analysis — investigate a deadlock that just occurred

      1. On the Recent Deadlock Analysis tab, click Create Analysis Task. DAS analyzes the latest deadlock log from SHOW ENGINE INNODB STATUS.

      2. Specify a time range to filter results.

      3. Find a task and click View Details in the Details column to see the full diagnostic results.

    • Full Deadlock Analysis — monitor deadlock trends over a time range On the Full Deadlock Analysis tab, specify a time range to view deadlock trends and the details of each deadlock.

    • Other Deadlock Analysis — diagnose live metadata locks or transaction blocking

      1. On the Other Deadlock Analysis tab, click Create Analysis Task. DAS analyzes live metadata locks and transaction blocking from information_schema and performance_schema.

      2. Specify a time range to filter results.

      3. Click the image icon to the left of a result to view statistics.

      4. Click View Details in the Actions column to open the deadlock analysis diagram. Hover over a session to see its lock wait diagram, or click a session to view its details.

What's next

After running deadlock analysis, use the thread IDs from the results to investigate the related transactions on the SQL Explorer and Audit page. This helps you trace the root cause — for example, identifying a long-running transaction that locked rows and caused subsequent sessions to enter the LOCK WAIT state.