Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

View Mysql lock table statement

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Early in the morning to brush the data, a large number of table structure alter statements, the table will be locked.

Locking tables may be encountered in the use of the database, resulting in timeouts when other processes access the same table. If it is production, you will see a large number of pool kneeling. If you are browsing sql, you should immediately understand what is going on.

Show full processlist

Show which threads are running, view lock table statements, and so on:

The situation of locking the table is like the picture above: waiting for table metadata lock, if it is not in conflict with other things, it will be fine on its own, or it can stop its own sql and it will release the lock. In case of conflict with other things, it can be killed, kill 2292.

Check the table that is being locked and note: I didn't execute this at the time of the accident. I don't know the result. I forget it every time.

Show OPEN TABLES where In_use > 0

View transactions that are being locked

SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCKS

View transactions waiting for locks

SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCK_WAITS

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report