SHOW STATUS like '%table_locks% '
Table_locks_immediate | 105 |
table_locks_waited | 3 |
If the value of the table_locks_waited is higher, then there is a more serious table-level lock contention condition. At this point, we need to do a further review of the application to determine where the problem lies.
Table_locks_immediate refers to the number of times a table-level lock can be obtained immediately, while table_locks_waited refers to the number of times a table-level lock cannot be acquired immediately. If the value of table_locks_waited is larger, and you are experiencing performance problems, you may want to divide the large table into smaller tables, for example, you can create a proprietary cache table for a custom module, or otherwise reduce the size of the table. or reduce the frequency of table-level lock command calls. For some tables, such as Cache_*,watchdog, and Accesslog tables, one way to reduce the size of a table is to reduce the life cycle of the data.
View MySQL lock condition