当前位置:网站首页>Introduction to the isolation level of gbase 8s
Introduction to the isolation level of gbase 8s
2022-06-25 04:32:00 【Eight delicacies tofu】
The database provides 5 There are different isolation levels :Dirty read Dirty reading 、Committed read Submit to read 、Last Committed read Finally submit to read 、Cursor read Cursor read 、Repeatable read Repeatable .
1. Dirty reading
Use this isolation level , The database server does not check whether records are locked , No locks are assigned .
In the process of dirty read query , You can query any data , Even those records that have been modified but not yet submitted , therefore Dirty-read The isolation level will produce phantom reads 、 The problem of non repetition and dirty reading . There are only... In the non log database Dirty-read An isolation level .
2. Submit to read
Committing reads means ensuring that all records read are committed to the database , Can avoid reading dirty data .
The difference between a committed read and a dirty read is , To ensure that the data is not dirty , You need to check the lock status of the record when reading the record , Try to add... To the record S Lock to determine whether the record is added X lock , So as to determine whether the record is dirty data . When the record is being added X In the lock state , Unable to read the record , If there is no record X lock , Then you can add S lock , But submitting a read does not add S lock , Just try to add S Lock to determine whether there is already X lock . One of the characteristics of submitted reading is : Try to add S lock , But without S lock .
3. Finally submit to read
To solve the problem Committed Read Deficiency , When the record is locked , Adopted Committed Read The process needs to wait . Application concurrency is affected , Dirty reads cannot guarantee the expected results . The database supports the last commit read isolation level , Also known as optimistic locking mechanism .
Grammatically , stay COMMITTED READ That's an increase from LAST COMMITTED Options , It is located in the DIRTY READ And COMMITTED READ A level of isolation between , It can avoid dirty reading problems , Can also be solved COMMITTED READ The problem of concurrency lock conflicts .
Last committed When the isolation level reads data , No record lock check , Directly read the last submitted version , There is no need to add... To the read record S lock .
because Last committed The isolation level reads the data of the last submitted version , that , The currently read record has not been modified ( No, X The lock state ), At this point, you can directly read the record ; If the currently read record is being modified ( Combined with the X The lock state ), So how to read the last submitted record ? There is only one record in memory that is being modified , The value before modification exists in the logical log ( Logical log cache or logical log file ), At this point, you need to read the logical log to get the last submitted version . This is why tables that support the last commit read isolation level must use row level locks , Page level locks are not supported .
4. Cursor read
For non update cursors , Apply a shared lock to all records read by the cursor , When the next row of records is read , The shared lock is released . For update cursors (For update), A lift lock will be applied to the read record (U lock ), Until the cursor closes .
Retrieving data through a cursor , The shared lock will remain in place until the next FETCH sentence . Therefore, cursor reading can ensure that in the process of cursor program processing , Records are not modified .
5. Repeatable
With this isolation level , The database adds S lock , Verify that the data can be read . Until the transaction is committed , The lock can be released . Other users can read data , But the same data cannot be modified .
When a record is read at the repeatable read isolation level , Add... To the record S lock , So you can ensure that before the end of the transaction , Other transactions cannot be modified , In the same transaction, the records read before and after are the same .
In the process of using repeatable read isolation level query , You need to add... To the read record S lock , It can ensure that the records read are submitted , At the same time, it can ensure that the records read multiple times are consistent , therefore Repeatable read Isolation level can solve the problem of parallel scheduling 3 A question : Dirty reading 、 Do not repeat reading and phantom reading .
边栏推荐
- 2021.4.15 note the difference between let, const and VaR in ES6
- Introduction to intstream API
- 论文笔记: 多标签学习 ESMC (没看懂, 还没写出来, 暂时放这里占个位置)
- Numpy NP tips: squeeze and other processing of numpy arrays
- Numpy NP tips: use OpenCV to interpolate and zoom the array to a fixed shape cv2 resize(res, dsize=(64, 64), interpolation=cv2. INTER_ CUBIC)
- MySQL order by
- Unit test coverage
- CTF_ Web: Advanced questions of attack and defense world expert zone WP (1-4)
- 1280_ C language to find the average value of two unsigned integer
- English Grammar - pronunciation rules
猜你喜欢

Finereport (sail soft) handling the problem that the histogram data label is blocked

CTF_ Web: how to recognize and evaluate a regular expression

PHP extracts and analyzes table contents, and collects bidding information

Nodejs connects to MySQL through heidisql, and ER appears_ BAD_ DB_ ERROR: Unknown database 'my_ db_ books'

论文笔记: 多标签学习 ESMC (没看懂, 还没写出来, 暂时放这里占个位置)

CTF_ Web: advanced problem WP (5-8) of attack and defense world expert zone

Value transfer between parent and child components of wechat applet

CTF_ Web: deserialization of learning notes (II) CTF classic test questions from shallow to deep

马斯克发布人形机器人,AI对马斯克为什么意义重大?

CTF_ Web: Advanced questions of attack and defense world expert zone WP (19-21)
随机推荐
php封装curl发送get、post请求方法,并使用
Gbase 8s parallel operation problem scenario description
JS arrow function
Leetcode points to the leetcode road of offering II 091 house painting [dynamic planning] heroding
Summary of various problems encountered by cocos2d-x
GbASE 8s中的Blob 页(Blobspace page)
Lecture record: new application of inertial navigation - inertial measurement
"How to carry out industrial positioning" in local / Park industrial planning
95% of programmers fish here
小白学习MySQL - 统计的'投机取巧'
GBASE 8s的隔离级别介绍
Value transfer between parent and child components of wechat applet
[kubernetes series] installation and use of Helm
Laravel document sorting 1. Installation and Preliminary Configuration
简单的恶意样本行文分析-入门篇
Thorough understanding of database transactions
"Renaissance" in the digital age? The bottom digital collection makes people happy and sad
A detailed summary of TCP connection triple handshake
什么是存储引擎以及MySQL常见的三种数据库存储引擎
LeetCode 劍指Offer II 091 粉刷房子[動態規劃] HERODING的LeetCode之路