当前位置:网站首页>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]](/img/71/6476f2d58255c78ac8f58fbfc6a0c9.png)
[Shakespeare: keep the fun of being a man]

一文入门Redis

Pytoch learning notes -- Summary of common functions 3

Exploration of 6-wire SPI transmission mode

Save the image with gaussdb (for redis), and the recommended business can easily reduce the cost by 60%

Crazy God redis notes 12

Matlab -- CVX optimization kit installation
![[IJCAI 2022] parameter efficient large model sparse training method, which greatly reduces the resources required for sparse training](/img/d4/bcc577f320a893c7006177993b2e7a.png)
[IJCAI 2022] parameter efficient large model sparse training method, which greatly reduces the resources required for sparse training

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

Storage structure of cross linked list
随机推荐
推荐收藏,这或许是最全的类别型特征的编码方法总结
Boomi荣获“多元化最佳首席执行官奖”和“职业成长最佳公司奖”,在大型公司类别中跻身50强
如何构建面向海量数据、高实时要求的企业级OLAP数据引擎?
阿唐的小帮手
基于Caffe ResNet-50网络实现图片分类(仅推理)的实验复现
Exclusive lock
leetcode:6127. 优质数对的数目【位运算找规律 + 两数之和大于等于k + 二分】
MySQL check whether the table is locked
递归菜单查询(递归:自己查自己)
Data system partition design - partition rebalancing
Is there only one lib under JDBC in Seata?
MySQL 悲观锁
HDD Hangzhou station · harmonyos technical experts share the features of Huawei deveco studio
What is a physical firewall? What's the effect?
Permission management - delete menu (recursive)
Shared lock
推荐系统-协同过滤在Spark中的实现
Waterfall flow layout
[Shakespeare: keep the fun of being a man]
Experimental reproduction of image classification (reasoning only) based on caffe resnet-50 network