当前位置:网站首页>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 .
边栏推荐
- Online and offline problems
- Commodity price visualization
- D - How Many Answers Are Wrong
- How to recover Huawei router's forgotten password
- Postman核心功能解析-参数化和测试报告
- GTSAM中李群的運用
- RestTemplate、Feign实现Token传递
- 10m25dcf484c8g (FPGA) amy-6m-0002 BGA GPS module
- Reading notes of effective managers
- selenium源码通读·9 |DesiredCapabilities类分析
猜你喜欢
[wechat applet] build a development tool environment
Usage of test macro of GTEST
全链路压测:构建三大模型
JMeter做接口测试,如何提取登录Cookie
进程和线程的理解
Function of contenttype
Fault, error, failure of functional safety
Clock in during winter vacation
Detailed explanation of P problem, NP problem, NPC problem and NP hard problem
E - 食物链
随机推荐
Online and offline problems
CoordinatorLayout+NestedScrollView+RecyclerView 上拉底部显示不全
Title 1093: character reverse order
Idea new UI usage
Web界面元素的测试
D - How Many Answers Are Wrong
黑猫带你学UFS协议第18篇:UFS如何配置逻辑单元(LU Management)
Buuctf-[[gwctf 2019] I have a database (xiaoyute detailed explanation)
[C language] string left rotation
进程和线程的理解
公司视频加速播放
LeetCode 731. 我的日程安排表 II
[postman] collections - run the imported data file of the configuration
IPv6 comprehensive experiment
[postman] the monitors monitoring API can run periodically
数学三大核心领域概述:几何
What are the test sites for tunnel engineering?
【Postman】Monitors 监测API可定时周期运行
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
Basic knowledge of error