当前位置:网站首页>Brief introduction to mvcc
Brief introduction to mvcc
2022-07-03 12:50:00 【Mcc_ mingchao】
MVCC(Multi-Version Concurrency Control) Multi version concurrent control .
We are learning about MVCC Before , First, let's learn about some common locks .
Read the lock : Also called Shared locks 、S lock , If business T For data objects A add S lock , The transaction T You can read A But it can't be modified A, Other affairs can only be right again A Add S lock , Instead of X lock , until T Release A Upper S lock . This ensures that other things can be read A, But in T Release A Upper S You can't do it before you lock it A Make any changes .
Write lock : It's also called exclusive lock 、X lock . If business T For data objects A add X lock , Business T You can read A You can also modify A, Other affairs can no longer be right A Add any locks , until T Release A The lock on the . This ensures that the rest of the business is T Release A The lock on can't be read or modified before A.
Table locks : The object of operation is the data table .Mysql Most lock strategies support , It is a locking strategy with the lowest system overhead but the lowest concurrency . Business t Lock the whole watch , Other transactions are readable and not writable , If write lock is added , Then the addition, deletion and modification of other affairs are not allowed .
Row-level locks : The operand is a row in the data table . yes MVCC Technology is used more . Row level lock has a high cost to the system , But it's better to deal with high concurrency .
MVCC Most transaction engines that support row locking , No longer simply use row lock to control database concurrency , Instead, combine the row lock of the database with multiple versions of the row , It's just a small expense , You can read without locking , So as to greatly improve the concurrency performance of the database system .
MVCC working process
InnoDB Of MVCC, This is achieved by saving two hidden columns behind each row of records . These two columns , A created version number that holds the line , A deleted version number that saves the row . Every time you start a new business , The system version number will increase automatically . The system version number at the start of the transaction will be the version number of the transaction , It is used to compare with the version number of each line of records found .
Innodb Hidden columns in
Innodb adopt undo log Save a snapshot of the information of the old version of the changed row . InnoDB Three hidden columns are added for each row of data in the internal implementation of MVCC.
边栏推荐
猜你喜欢
Low code platform international multilingual (I18N) technical solution
Eureka self protection
【ManageEngine】IP地址扫描的作用
Alibaba is bigger than sending SMS (user microservice - message microservice)
initial、inherit、unset、revert和all的区别
并网-低电压穿越与孤岛并存分析
With pictures and texts, summarize the basic review of C language in detail, so that all kinds of knowledge points are clear at a glance?
【计网】第三章 数据链路层(2)流量控制与可靠传输、停止等待协议、后退N帧协议(GBN)、选择重传协议(SR)
The future of cloud computing cloud native
剑指Offer04. 二维数组中的查找【中等】
随机推荐
【習題七】【數據庫原理】
Sqoop1.4.4原生增量导入特性探秘
最新版抽奖盲盒运营版
启用MemCached的SASL认证
Is it OK to open an account for online stock speculation? Is the fund safe?
【ManageEngine】IP地址扫描的作用
Method overloading and rewriting
02_ Lock the code, and don't let the "lock" become a worry
Openstack node address change
Everything comes to him who waits
Express abstract classes and methods
Xctf mobile--app1 problem solving
Redhat5 installing socket5 proxy server
elastic_ L01_ summary
The latest version of blind box mall thinkphp+uniapp
[ArcGIS user defined script tool] vector file generates expanded rectangular face elements
Use Tencent cloud IOT platform to connect custom esp8266 IOT devices (realized by Tencent continuous control switch)
LeetCode 0556. Next bigger element III - end of step 4
Define a list, store n integers, and calculate the length, maximum value, minimum value and average value of the list
【习题五】【数据库原理】