当前位置:网站首页>Gap locks
Gap locks
2022-07-25 16:05:00 【Leon_ Jinhai_ Sun】
Gap Locks( Clearance lock ) Used to lock records within a certain range . It blocks intervals in index records , Or the range before the first index record , Or the range after the last index record . It is mainly used for Prevent other transactions from inserting data inside the interval in the index record , And cause unreal reading . about Read submitted (Read Committed, RC) Transaction isolation level ,Gap Locks Will automatically fail .
Data locking range analysis
hypothesis user In the table user_id by Primary key (Primary Key) And for unsigned int type .
select * from user where user_id < 7 for update;The record range locked by the above operation is user_id >= 0 To user_id = 6 The record of , Only after the transaction is committed , Only other transactions can operate records in this range . Notice that even user_id=3 The corresponding record does not exist , Before the transaction is committed , Insert user_id=3 Records are also not allowed , Otherwise, there is no way to solve the problem of unreal reading .
select * from user where user_id > 7 and user_id < 1000 for update;The record range locked by the above operation is user_id > 7 To user_id < 10000 The record of , Only after the transaction is committed , Only other transactions can operate records in this range .
select * from user where user_id > 1000 for update;The record range locked by the above operation is user_id > 1000 To int Record between maximum values , Only after the transaction is committed , Only other transactions can operate records in this range .
边栏推荐
猜你喜欢

leetcode:6127. 优质数对的数目【位运算找规律 + 两数之和大于等于k + 二分】

如何构建面向海量数据、高实时要求的企业级OLAP数据引擎?

Which led display manufacturer is better

General test case writing specification

Storage structure of cross linked list

# JWT 图解

Alibaba's internal "100 billion level concurrent system architecture design notes" are all inclusive, too comprehensive

使用 Terraform 在 AWS 上快速部署 MQTT 集群

Ice 100g network card fragment message hash problem

Upgrade esxi6.7.0 to 7.0u3f (updated on July 12, 2022)
随机推荐
pymongo保存dataframe格式的数据(insert_one, insert_many, 多线程保存)
2600 pages in total! Another divine interview manual is available~
MySQL 悲观锁
Which led display manufacturer is better
物理防火墙是什么?有什么作用?
华为2023届提前批预热开始!左 神的程序代码面试指南终派上用场
报表工具的二次革命
【莎士比亚:保持做人的乐趣】
Redis distributed lock, it's really impossible without it
共享锁(Shared Lock)
Exploration of 6-wire SPI transmission mode
今天睡眠质量记录84分
泰雷兹推出解决方案,助力SAP客户控制云端数据
leetcode:154. 寻找旋转排序数组中的最小值 II【关于旋转排序数组的中后定位二分法】
面试8家公司,1周拿了5个offer,分享一下自己的心得
Matlab simulation of BPSK modulation system (1)
TypeError: Unrecognized value type: <class ‘str‘> ParserError: Unknown string format
Wavelet transform --dwt2 and wavedec2
Zhaoqi Kechuang high-level innovation and Entrepreneurship Talent Service Platform at home and abroad, mass entrepreneurship and innovation achievement transformation platform
Okaleido launched the fusion mining mode, which is the only way for Oka to verify the current output