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 mysql locking rule?

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly explains "what is the mysql locking rule". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn what the mysql locking rule is.

Description

1. Next-keylock is the basic unit of locking.

Next-keylock is an interval that opens before and closes later.

2. Only objects accessed during the search will be locked.

3. Equivalent query, when the unique index is locked, the next-keylock is reduced to a row lock.

If it is not a unique index, next-keylock degenerates to a gap lock when traversing to the right and the last value does not meet the equivalence condition.

4. Scope query.

Whether it is a unique index or not, the range query needs to access the first value that does not meet the condition.

Example

CREATE TABLE `demo_ table` (`id`bigint (20) NOT NULL AUTO_INCREMENT COMMENT 'key', `a`varchar (32) NOT NULL COMMENT 'Meituan order uid', `b`varchar (32) NOT NULL COMMENT' Meituan order uid', `c`varchar (32) NOT NULL COMMENT 'Meituan order uid' PRIMARY KEY (`id`), UNIQUE KEY `a` (`a`), KEY `b` (`b`),) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='' Thank you for your reading, the above is the content of "what are the mysql locking rules". After the study of this article, I believe you have a deeper understanding of what the mysql locking rules are, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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