当前位置:网站首页>Database - current read and snapshot read
Database - current read and snapshot read
2022-07-06 06:14:00 【Snow peak expensive】
The current reading :insert update delete for update
Read the snapshot : Non blocking read without lock ,select. The purpose is to improve concurrency
stay RC Under isolation level , The current read and snapshot read results are the same .
stay RR Under isolation level , The current read and snapshot read results may be different
for example
Business 1 And business 2 Read a piece of data .
select * from user where id =1;
id money
1 200
Business 2 Modifying data
update user set money = 1000 where id = 1;
commit;
Business 1 read ( Read the snapshot ):
select * from user where id = 1;
id money
1 200
And in the execution ( The current reading ) select * from user where id = 1 for update;
id money
1 1000
RR Implementation principle of non blocking read at level :
There are actually 3 The fields are :
DB_TRX_ID : Transactions that modify this data ID
DB_ROLL_PRT: rollback pointer
DB_ROW_ID: Hidden lines ID
Business id=1, The data from 12 Change it to 32.
- The bank adds an exclusive lock
- Copy the data before modification , To undo log Inside
- Modify the data of the current line , Fill in transactions id, rollback pointer
Business id=2, Again on this trip Field3 Make changes . - Add an exclusive lock
- Copy the data before modification , To undo
- Modify the data of the current line , Fill in transactions id, rollback pointer
Every time you make a modification , Will generate one UNDO log data . When the transaction snapshot reads data, it will pass readView Algorithm , Use the current transaction id And log Of DB_TRX_ID Compare to determine which version of data is taken .
边栏推荐
- [C language] string left rotation
- Digital triangle model acwing 1015 Picking flowers
- 技术分享 | 常见接口协议解析
- 【API接口工具】postman-界面使用介绍
- 把el-tree选中的数组转换为数组对象
- 数字三角形模型 AcWing 1015. 摘花生
- Manhattan distance and Manhattan rectangle - print back font matrix
- 【Tera Term】黑猫带你学TTL脚本——嵌入式开发中串口自动化神技能
- Cognitive introspection
- [eolink] PC client installation
猜你喜欢
SQLMAP使用教程(三)实战技巧二
【无App Push 通用测试方案
[wechat applet] build a development tool environment
黑猫带你学eMMC协议第10篇:eMMC读写操作详解(read & write)
[postman] collections configuration running process
二维码的前世今生 与 六大测试点梳理
Redis 核心技术与实战之 基本架构:一个键值数据库包含什么?
Gtest之TEST宏的用法
联合索引的左匹配原则
About PHP startup, mongodb cannot find the specified module
随机推荐
IP day 16 VLAN MPLS configuration
Testing and debugging of multithreaded applications
请求转发与重定向
黑猫带你学eMMC协议第10篇:eMMC读写操作详解(read & write)
F - True Liars (种类并查集+DP)
Interface test: what are the components of the URL in fiddler
[C language] qsort function
properties文件
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
G - Supermarket
Investment strategy discussion and market scale prediction report of China's solid state high power amplifier industry from 2022 to 2028
ESP32 ESP-IDF看门狗TWDT
数学三大核心领域概述:代数
还在为如何编写Web自动化测试用例而烦恼嘛?资深测试工程师手把手教你Selenium 测试用例编写
自定义指定路由上的Gateway过滤器工厂
Isam2 and incrementalfixedlagsmooth instructions in gtsam
Manhattan distance sum - print diamond
[eolink] PC client installation
GTSAM中李群的運用
HCIA review