当前位置:网站首页>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 .
边栏推荐
- [Shakespeare: keep the fun of being a man]
- Permission management - delete menu (recursive)
- Is there only one lib under JDBC in Seata?
- Permission management - role assignment menu
- 开发者如何为React Native选择合适的数据库
- 电阻电路的等效变化(Ⅱ)
- 阿唐的小帮手
- How to build an enterprise level OLAP data engine for massive data and high real-time requirements?
- leetcode:154. 寻找旋转排序数组中的最小值 II【关于旋转排序数组的中后定位二分法】
- Product upgrade observation station in June
猜你喜欢

General test case writing specification

How to build an enterprise level OLAP data engine for massive data and high real-time requirements?

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

ML - Speech - traditional speech model

MQTT X CLI 正式发布:强大易用的 MQTT 5.0 命令行工具

终极套娃 2.0 | 云原生交付的封装

Equivalent change of resistance circuit (Ⅱ)

TypeError: Unrecognized value type: <class ‘str‘> ParserError: Unknown string format

食品安全丨无处不在的冷冻食品,你真的了解吗?
![[wechat applet] detailed explanation of applet host environment](/img/57/582c07f6e6443f9f139fb1af225ea4.png)
[wechat applet] detailed explanation of applet host environment
随机推荐
权限管理-删除菜单(递归)
Ml image depth learning and convolution neural network
General test case writing specification
面试突击:为什么 TCP 需要 3 次握手?
Upgrade esxi6.7.0 to 7.0u3f (updated on July 12, 2022)
mysql 表读锁
推荐收藏,这或许是最全的类别型特征的编码方法总结
MySQL table write lock
Release of v6.5.1/2/3 series of versions of Xingyun housekeeper: the ability of database OpenAPI continues to be strengthened
Golang review summary
Mysql读写锁
通用测试用例写作规范
共2600页!又一份神级的面试手册面世~
Reasons for data format conversion when matlab reads the displayed image
Intention lock
mysql 隔离级别事务
Matlab simulation of BPSK modulation system (1)
Geogle colab notes 1-- run the.Py file on the cloud hard disk of Geogle
MySQL tutorial 66 data table query statement
报表工具的二次革命