当前位置:网站首页>MySQL mvcc multi version concurrency control
MySQL mvcc multi version concurrency control
2022-06-10 23:10:00 【Li_ XiaoJin】
Some content about multi version concurrency control . Mainly from 《 High performance MySQL》, Make notes .
MCVV The implementation of the , It is achieved by saving a snapshot of the data at a certain point in time . No matter how long it takes , Each transaction sees the same data . Depending on when the transaction started , Each transaction is on the same table , The data seen at the same time may be inconsistent .
This paper mainly introduces InnoDB Of MVCC Realization .
InnoDB Of MVCC This is achieved by saving two hidden columns after each row of records . These two columns , A save line creation time , An expiration time for a saved row ( Or delete the time ). The actual storage is not time , It can be regarded as the system version number .
Each time a transaction is started , The system version number will be incremented . The system version number at the start of the transaction will be the version number of the transaction , Used to compare with each row of records queried .
stay REPEATABLE READ Under isolation level ,MCCC The operation is as follows :
- SELECT InnoDB Each line of records will be checked according to two conditions :
- InnoDB Only find data rows older than the current transaction version , This ensures that the rows read by the transaction , Or something that existed before it started , Either the transaction itself inserts or modifies .
- The deleted version of the line is either undefined , Or greater than the current transaction , You can ensure that the rows read by the transaction , Delete before the transaction starts .
Only when the above two conditions are met can the query result be returned .
- INSERT InnoDB Save the current system version number for each newly inserted row as the row version number .
- DELETE InnoDB Save the current system version number for each deleted row as the deletion ID of the row .
- UPDATE InnoDB Insert a new record for , Save the current version number as the line version number of the line , At the same time, save the current system version number to the original line as the line deletion identifier .
Save the pros and cons of these two version numbers
advantage :
- This allows most read operations to be unlocked
- It can make data operation simple , Good performance , This ensures that only rows that meet the criteria will be read
shortcoming :
- Each row requires additional storage space
- More line checking operations are required
- Some extra maintenance work is required
MVCC Only in REPEATABLE READ and READ COMMITED These two isolation levels work , The other two isolation levels are incompatible ,READ UNCOMMITED Read only the latest data row at a time , Instead of data lines that match the current transaction version ,SERIALIZABLE All read rows will be locked .
Copyright: use Creative Commons signature 4.0 International license agreement to license Links:https://lixj.fun/archives/mvcc Multi version concurrency control
边栏推荐
- 【原创】医鹿APP九价HPV数据抓包分析
- Redis数据结构
- 数组、List、Set、Map、Properties依赖注入格式
- laravel8 实现阿里云文件上传
- Sdn/nfv application in cloud data center
- Array, list, set, map, properties dependency injection format
- 数据与信息资源共享平台(八)
- Sherri Monroe was appointed as the new executive director of the additive manufacturers green trade association
- 数学与素质教育
- 28岁自学编程会不会太晚了?靠谱吗?
猜你喜欢

Blue Bridge Cup_ A fool sends a letter_ recursion

Question bank and simulation test of 2022 tea artist (intermediate) operation certificate examination

Vulnhub's DC3

28岁自学编程会不会太晚了?靠谱吗?

分布式基础

数组、List、Set、Map、Properties依赖注入格式

JS sensitive information leak detection tool

vulnhub之DC2

Web3技术栈权威指南【2022】

【GMM+KDE】基于MATLAB的GMM和KDE核估计得目标跟踪仿真
随机推荐
MySQL组合索引不被命中使用的情况
Auto. JS Pro development environment configuration
ICML2022 | 从零开始重新审视端到端的语音到文本翻译
Can Huawei matepad become the secondary screen of your laptop?
SMB anonyme
爬虫学习知识
关于idea中src下 无法new一个package
The definition of the metauniverse and the seven infinite features
MA8601 pin√pin替代汤铭FE1.1s无须更改电路板|完美替代FE1.1s方案
数据与信息资源共享平台(四)
Simulated 100 questions and simulated examination of G2 utility boiler stoker examination in 2022
Software project management 6.10 Cost budget
Online questionnaire system based on php+web+mysql
我们对产业互联网的认识,还是困囿于互联网式的平台和中心的逻辑之中
0223-总结
Keras deep learning practice (8) -- using data enhancement to improve neural network performance
PwnTheBox,Web:hello
【006】初识字符串
Unity code registers events for animation
集度夏一平:不是所有事都向李彦宏汇报,靠产品跟小米华为竞争