Early in the morning of the brush data, a large number of changes to the table structure of the ALTER statement, the table is locked.
The use of the database may encounter the situation of the lock table, causing other processes to access the same table when the timeout occurs, if the production will see a lot of pool kneeling, if you are in the brush SQL, you should immediately understand what the situation.
Show full processlist;
Shows which threads are running, view the lock table statements, and so on:
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/95/09/wKiom1kRK_KBJbcQAAC0P6_DVG8070.png "title=" 111. PNG "alt=" Wkiom1krk_kbjbcqaac0p6_dvg8070.png "/>
The condition of the lock table is as follows: Waiting for table metadata lock, if it is not in conflict with other things, it will be good, can also stop their own brush of SQL it will release the lock, and other things in conflict with the case can be killed, kill 2292.
View the table being locked, Note: This in the event of an accident I did not do, do not know the result, every time forget.
Show OPEN TABLES where In_use > 0;
Viewing transactions that are being locked
SELECT * from INFORMATION_SCHEMA. Innodb_locks;
View transactions waiting for a lock
SELECT * from INFORMATION_SCHEMA. Innodb_lock_waits;
This article is from the "Ant" Blog, please be sure to keep this source http://215687833.blog.51cto.com/6724358/1923549
View MySQL Lock table statements