当前位置:网站首页>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 .
边栏推荐
- 记录小知识点
- 什么是持久化?redis 持久化中的RDB和AOF是什么?
- cnpm : 无法加载文件 C:\Users\Administrator\AppData\Roaming\npm\cnpm.ps1,因为在此系统上禁止运行脚本。
- A detailed summary of TCP connection triple handshake
- 第二十五周记录
- Gbase 8s parallel operation problem scenario description
- PHP extracts and analyzes table contents, and collects bidding information
- 如何筛选出和产品相关的词,精准排除掉无效词
- Laravel document sorting 3. CSRF protection
- 1. Phase II of the project - user registration and login
猜你喜欢
![L'épée leetcode fait référence au chemin leetcode de l'offre II 091 pour peindre la maison [planification dynamique] heroding](/img/ad/69fce7cf064479a0ddd477fb935de2.png)
L'épée leetcode fait référence au chemin leetcode de l'offre II 091 pour peindre la maison [planification dynamique] heroding

CTF_ Web: Advanced questions of attack and defense world expert zone WP (1-4)

Lecture record: new application of inertial navigation - inertial measurement

OBS Browser+浏览器的基本使用

GBASE 8s 索引R树

"Renaissance" in the digital age? The bottom digital collection makes people happy and sad

Error 1062 is reported during MySQL insertion, but I do not have this field.

i. Max development board learning record

A detailed summary of TCP connection triple handshake

CTF_ Web: Learn flask template injection (SSTI) from 0
随机推荐
Laravel document sorting 9. Blade template
CTF_ Web: advanced problem WP (5-8) of attack and defense world expert zone
CTF_ Web: Advanced questions of attack and defense world expert zone WP (15-18)
【LeetCode】148. Sort linked list
OBS Browser+浏览器的基本使用
Anaconda installation +tensorflow installation +keras installation +numpy installation (including image and version information compatibility issues)
cnpm : 无法加载文件 C:\Users\Administrator\AppData\Roaming\npm\cnpm.ps1,因为在此系统上禁止运行脚本。
坐标系左乘右乘
SQL injection details
Smart contract learning materials
2021.4.15 note the difference between let, const and VaR in ES6
Retrofit 源码分析
A detailed summary of TCP connection triple handshake
GBASE 8s的数据视图
深度学习——几种学习类型
Upgrade cmake
95% of programmers fish here
小白学习MySQL - 统计的'投机取巧'
GBASE 8s的级联删除功能
IntStream API介绍