Overview

This article describes table-level Lock wait in RDS MySQL.

 

Detail

Alibaba Cloud reminds you that:

  • Before you perform operations that may cause risks, such as modifying instance configurations or data, we recommend that you check the disaster recovery and fault tolerance capabilities of the instances to ensure data security.
  • You can modify the configurations and data of instances including but not limited to Elastic Compute Service (ECS) and Relational Database Service (RDS) instances. Before the modification, we recommend that you create snapshots or enable RDS log backup.
  • If you have authorized or submitted security information such as the logon account and password in the Alibaba Cloud Management console, we recommend that you modify such information in a timely manner.

During the daily use of apsaradb RDS for MySQL instances, table-level locks may wait. The following are two common scenarios.

 

Explicitly lock table

Run the following command to cause the DML session to wait for table-level locks:

lock tables tab_name read;

The blocked related content is as follows.

显式lock

 

Implicit lock table

When the default parameters of mysqldump are used for data export, the -- lock-tables function is enabled by default.  Option, causing DML operations on the export table to wait for a table-level lock.

Note: we recommend that you use mysqldump to export data during off-peak hours and configure the -- single-transaction method.  Option to export Innodb tables, avoiding lock-wait exceptions at the table level.

隐式lock

 

Application scope

  • ApsaraDB RDS for MySQL