View Lock Waits

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 锁等待查看

| username: TiDBer_h9um7nOg

【TiDB Usage Environment】Production Environment or Test Environment or POC
【TiDB Version】
【Encountered Issue】
For a v4.0 cluster, besides checking the log files for lock wait information, is there a system table where this information can be viewed?
【Reproduction Path】What operations were performed that led to the issue
【Issue Phenomenon and Impact】

【Attachments】

Please provide the version information of each component, such as cdc/tikv, which can be obtained by executing cdc version/tikv-server --version.

| username: HACK | Original post link

There should be no related system tables, but higher versions have them.

| username: 啦啦啦啦啦 | Original post link

In version 4.0, the cluster_slow_log and statement_summary_history views under information_schema record the lock wait duration of related SQL. Starting from version 5.1, a lock view has been added.

| username: ddhe9527 | Original post link

Yes, there is the INFORMATION_SCHEMA.DATA_LOCK_WAITS table.

| username: tidb狂热爱好者 | Original post link

There is, the INFORMATION_SCHEMA.DATA_LOCK_WAITS table

This table is real-time, the lock disappears once it is resolved. Is there a table that records historical locks?

| username: ddhe9527 | Original post link

There is no historical lock information table, which is the same as MySQL. You can create your own monitoring for this. Insert the data from the processlist and data_lock_waits tables into a historical table every minute, and keep the data for the last month in the historical table.

| username: tidb狂热爱好者 | Original post link

Okay, thank you, teacher. I have implemented this feature myself.

| username: HACK | Original post link

You’re referring to a higher version.

| username: tidb狂热爱好者 | Original post link

Does the table in version 6.1 still record lock conflicts in the statement summary history?

| username: system | Original post link

This topic was automatically closed 1 minute after the last reply. No new replies are allowed.