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 view deadlock log in MySQL

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article introduces you how to view the deadlock log in MySQL, the content is very detailed, interested friends can refer to, hope to be helpful to you.

MySQL View deadlock Log

Under what circumstances will show engine innodb status cause deadlock?

The so-called deadlock: refers to two or more processes in the implementation process, caused by the competition for resources caused by a mutual waiting phenomenon, if there is no external force, they will not be able to move forward. At this point, it is said that the system is in a deadlock state or that the system has a deadlock. These processes that are always waiting for each other are called deadlock processes. Table-level locks do not produce deadlocks. Therefore, the solution to deadlock is mainly aimed at the most commonly used InnoDB.

Deadlock case

For example (the following session id is the primary key):

Mysql > select * from T3 where id=9 for update +-+ | id | course | name | ctime | +-+ | 9 | JX | f | 2016-03-01 11:36: 30 | +-+ row in set (0.00 sec)

Session2:

Mysql > select * from T3 where id insert into T3 values; ERROR 1213 (40001): Deadlock found when trying to get lock; try restarting transaction

Session2 is waiting for Session1's id=9 to lock, and session2 holds locks from 1 to 8 (note that the range of 9 to 19 is not locked by session2). Finally, session1 has to wait for session2 when inserting a new row, so a deadlock occurs.

About how to view the deadlock log in MySQL to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

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

Internet Technology

Wechat

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

12
Report