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

What is the use of mysql insert intention locks

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

Share

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

What is the use of mysql insertion intention lock? I believe many inexperienced people are at a loss about it. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

1. The insertion intention lock is a Gap lock, not an intention lock, but the result of an insert operation. When multiple transactions write different data to the same index gap at the same time, there is no need to wait for other transactions to complete, and lock waiting does not occur.

Suppose that a record index contains keys 4 and 7, and different transactions insert 5 and 6, respectively, and each transaction generates an insert intention lock, which is added to 4-7 to get an exclusive lock on the inserted row, but does not lock each other, because the data rows do not conflict.

2. Inserting an intention lock will not block any lock, and inserting a record will hold a record lock.

Example

Insert into test_user (user_id,name,age) values-TRX HAS BEEN WAITING 18 SEC FOR THIS LOCK TO BE GRANTED:RECORD LOCKS space id 6628 page no 4 n bits 72 index `index_ user`of table `test`.`test _ user` trx id 117851203 insert intention lock lock_mode X insert intention waitingRecord lock, heap no 1 PHYSICAL RECORD: n_fields 1; compact format; info bits 0 0: len 8; hex 73757072656d756d; asc supremum After reading the above, have you mastered the method of using mysql insertion intention lock? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

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

Development

Wechat

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

12
Report