In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how the mysql deadlock is produced, the article is very detailed, has a certain reference value, interested friends must read it!
Mysql is a relational database management system, and the SQL language used is the most commonly used standardized language for accessing databases. During the use of mysql, deadlocks occur. What is the reason for this?
Three locks for MySQL:
Table-level lock: low overhead, fast locking; no deadlock; large lock granularity, the highest probability of lock conflict and the lowest concurrency.
Row-level locks: expensive and slow to add locks; deadlocks occur; locking granularity is the smallest, the probability of lock conflicts is the lowest, and the degree of concurrency is the highest.
Page lock: the overhead and locking time are between table lock and row lock; deadlocks occur; lock granularity is between table lock and row lock, and the concurrency is average.
Algorithm:
Next KeyLocks lock, simultaneously locking the record (data), and locking the Gap in front of the record
Gap lock, do not lock the record, only record the previous Gap
Recordlock lock (lock data, not Gap)
So in fact, Next-KeyLocks=Gap lock + Recordlock lock
Under what circumstances will it cause a 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 the system has a deadlock, and 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.
The key to deadlocks is that two (or more) Session locks are not in the same order.
Then the corresponding key to solve the deadlock problem is to make different session locks in order.
The above is all the content of how the mysql deadlock is produced, thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.