In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article shows you the use of mysql key lock, the content is concise and easy to understand, it can definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
1. By default, innodb uses key locks to lock records.
Select... For update
2. When the query index contains unique attributes, the key lock will be optimized and degraded to a record lock, that is, only the index itself, not the scope, will be locked.
3. The key lock will degenerate in different scenes.
Example
Transaction 1 start transaction;select SLEEP (4); select * from test where age=22 for update;select * from test where age > 23 for update;select sleep (20); commit; * * transaction 2 start transaction;select sleep (8); select * from test where age=20 for update;select * from test where age=21 for update;select * from test where age=22 for update;select * from test where age=23 for update;commit * * transaction execution status transaction 1 start transaction > OK > time: 0s select SLEEP (4) > OK > time: 4.001s select * from test where age=22 for update > Affected rows: 0 > time: 0.001s select * from test where age > 23 for update > Affected rows: 0 > time: 0.001s select sleep (20) > OK > time: 20s commit > OK > time: 0 .001s * * transaction 2 start transaction > OK > time: 0.001s select sleep (8) > OK > time: 8s select * from test where age=20 for update > Affected rows: 0 > time: 0.001s select * from test where age=21 for update > Affected rows: 0 > time: 0.001s select * from test where age=22 for update > Affected rows: 0 > time: 14.158s select * from test where age=23 for update > Affected rows: 0 > time: 0. 001s commit > OK > time: 0s the above is the use of mysql key lock Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are 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.