当前位置:网站首页>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

边栏推荐
猜你喜欢
![[math] dot product and cross product](/img/f6/231fd30745dfc118f7d8a7df65cc4d.png)
[math] dot product and cross product

电脑重装系统如何在 Win11查看显卡型号信息

基因对疾病的影响规律--读论文

2022高压电工考试试题及答案

抖音直播新号怎么起号?抖音直播间不进人怎么办?

阿里云天池大赛赛题(机器学习)——O2O优惠券预测(完整代码)

OpenCV相机标定完全指南(有手就行)

服务端修改Cookie——跨域cookie发送机——通信加密——异或加密

Dingding conflicts with RStudio shortcuts--Dingding shortcut settings

2022 High Voltage Electrician Exam Questions and Answers
随机推荐
pr22.5最新版下载地址
阿里云天池大赛赛题(机器学习)——阿里云安全恶意程序检测(完整代码)
Ali YunTianChi competition problem (deep learning) - video enhancement (complete code)
360 评估反馈问题的示范案例
Ridge regression and LASSO regression
AttributeError: partially initialized module ‘cv2‘ has no attribute ‘gapi_wip_gst_GStreamerPipeline‘
数据库指标是怎么个意思
整数倍数数列
Improve the user experience and add a small detail to your modal popup
【二叉树】重建二叉树
松柏集(浮窗思)
查询某时间段获得的积分总积分的大小进行排序
了解CV和RoboMaster视觉组(五)滤波器、观测器和预测方法
2022 High Voltage Electrician Exam Questions and Answers
两种K线形态预示今日伦敦银走向
安装pytorch和cuda
How to do the stability test, this article thoroughly explains it!
Efficient review of deep learning DL, CV, NLP
gopacket使用示例
【服务器数据恢复】Ext4文件系统fsck后mount不上并报错的数据修复案例