View MySQL Lock table statements

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.