当前位置:网站首页>MySQL: Implementation Principles of Submitted Read and Repeatable Read | MVCC (Multi-Version Concurrency Control) - Notes for Your Own Use
MySQL: Implementation Principles of Submitted Read and Repeatable Read | MVCC (Multi-Version Concurrency Control) - Notes for Your Own Use
2022-08-09 04:22:00 【_ sauron】
MVCC
MVCC is multi-version concurrency control (Multi-Version Concurrency Control, MVCC for short), which is a way of implementing isolation level based on optimistic locking theory in MySQL, which is used to realize the implementation of committed read and repeatable read isolation level, also often referred to as a multiversion database.The MVCC mechanism will generate a consistent data snapshot (Snapshot) at the point in time of the data request, and use this snapshot to provide consistent reading at a certain level (statement level or transaction level).From the user's point of view, it appears that the database can provide multiple versions of the same data (system version number and transaction version number).
In MVCC multi-version concurrency control, read operations can be divided into two categories:
1. snapshot read
Read is the visible version of the record without locking.such as select
2. current read
The latest version of the record is read, and the record returned by the current read.Such as insert, delete, update, select...lock in sharemode/for update
MVCC: Each row of records actually has multiple versions. In addition to the data itself, each version of the record adds other fields
DB_TRX_ID: records the current transaction ID
DB_ROLL_PTR: points to the data on the undo log logpointer
Committed Read: A snapshot (Read View) is regenerated each time a statement is executed, and each time a query is selected.
Repeatable read: At the beginning of the same transaction, a global snapshot (Read View) of the current transaction is generated, when the query is selected for the first time.
Principles for reading snapshot content:
1. The version has not been submitted and cannot be read to generate a snapshot
2. The version has been submitted, but if it is submitted after the snapshot is created, it cannot be read
3. The version has been submitted, but it is submitted before the snapshot is created, you can read it
4. Your own update in the current transaction can be read


undo log
undo log: The rollback log, which saves a version of the data before the transaction occurs, is used for rollback operations during transaction execution, and is also a key technology for implementing read operations under multi-version concurrency control (MVCC).
DB_TRX_ID: Transaction ID
DB_ROLL_PTR: Rollback Pointer
Illustration: In this figure, the first transaction id is 1000, which uses (DB_ROLL_PTR) to save the address of the previous transaction operation

边栏推荐
- 【二叉树】重建二叉树
- Alibaba Cloud Tianchi Contest Question (Machine Learning) - Repeat Purchase Prediction of Tmall Users (Complete Code)
- 高效回顾深度学习DL、CV、NLP
- 两种K线形态预示今日伦敦银走向
- [Server data recovery] A case of data recovery when the Ext4 file system cannot be mounted and an error is reported after fsck
- UI中级操作(倾斜和雷达效果)
- How to do the stability test, this article thoroughly explains it!
- JVM学习——1——虚拟机基础概念
- 自动化测试-图片中添加文字注释,添加到allure测试报告中
- 阿里云天池大赛赛题(深度学习)——视频增强(完整代码)
猜你喜欢

Dingding conflicts with RStudio shortcuts--Dingding shortcut settings

pr22.5最新版下载地址

2022高处安装、维护、拆除考试练习题及模拟考试

软件质效领航者 | 优秀案例•国金证券DevOps建设项目

了解CV和RoboMaster视觉组(五)滤波器、观测器和预测方法

LeetCode - remove consecutive nodes with a sum of zero from a linked list

电脑重装系统如何在 Win11查看显卡型号信息
Improve the user experience and add a small detail to your modal popup

Ali YunTianChi competition problem (machine learning) - O2O coupons prediction (complete code)

单元测试覆盖率怎么算?
随机推荐
阿里云天池大赛赛题(机器学习)——O2O优惠券预测(完整代码)
Gopacket source code analysis
安装pytorch和cuda
“error“: { “root_cause“: [{ “type“: “circuit_breaking_exception“, “reason“: “[parent] D [solved]
Poly1CrossEntropyLoss的pytorch实现
Go常用命令与基础语法
npm package.json
全栈代码测试覆盖率及用例发现系统的建设和实践
分布式数据库怎样才能“叫好又卖座”
【Pyspark】udf使用入门
MKNetworkKit replacing domain name wrong solution
Oracle 的开窗函数使用详解
pytorch implementation of Poly1CrossEntropyLoss
TASSEL软件导入plink格式文件报错
2022年安全员-A证特种作业证考试题库及在线模拟考试
高效回顾深度学习DL、CV、NLP
Moonriver与Shiden的XCM集成现已上线
Integer multiple series
Win11一键重装系统后如何使用自带的故障检测修复功能
2022年熔化焊接与热切割考试模拟100题及在线模拟考试