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

How to check whether the table is locked in mysql

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

Share

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

This article mainly tells you briefly how to check whether the table is locked in mysql. You can check the relevant professional terms on the Internet or find some related books to supplement them. We will not dabble here, so let's go straight to the topic. I hope this article on how to check whether the table is locked in mysql can bring you some practical help.

Check to see if the table is locked:

Execute directly on the mysql command line: show engine innodb status\ G.

Look at the sql statement that caused the deadlock, analyze the index, and then optimize sql.

Then show processlist, look at the sql statement that caused the deadlock to take a long time.

Show status like'% lock%.

Check the locked status of the table and the steps to end the deadlock:

1. Check the locked status of the table

Show OPEN TABLES where In_use > 0; this statement records the current lock table status

two。 Query process

Show processlist lookup table locked process

Query the corresponding process kill id

3. Analyze the SQL of the lock table

Analyze the corresponding SQL, index the table, index the common fields, and index the fields associated with the table.

Look at what is being locked:

SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCKS.

Look at what is waiting for the lock:

SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCK_WAITS.

Mysql how to check whether the table is locked first to tell you here, for other related issues you want to know can continue to pay attention to our industry information. Our section will capture some industry news and professional knowledge to share with you every day.

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

Database

Wechat

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

12
Report