当前位置:网站首页>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 .
边栏推荐
- GBASE 8s 索引R树
- Failed to install redis interface
- "Comment positionner l'industrie" dans la planification industrielle locale / parc
- GBASE 8s存儲過程語法結構
- mysql的tinyint字段类型判断的疑惑
- Gbase 8s parallel operation problem scenario description
- 1280_ C language to find the average value of two unsigned integer
- IntStream API介绍
- 什么是存储引擎以及MySQL常见的三种数据库存储引擎
- The yii2 debug toolbar is missing
猜你喜欢

A detailed summary of four handshakes (or four waves) over TCP connections

单元测试覆盖率

unity Quad剔除背面并剔除透明部分的shader

cnpm : 无法加载文件 C:\Users\Administrator\AppData\Roaming\npm\cnpm.ps1,因为在此系统上禁止运行脚本。

讲座记录《惯性导航的新应用——惯性测量》

1280_ C language to find the average value of two unsigned integer

CTF_ Web: basic 12 questions WP of attack and defense world novice zone

NFT insider 63: the sandbox reached a cooperation with Time magazine, and YGG established Spain's subdao

什么是存储引擎以及MySQL常见的三种数据库存储引擎

Summary of various problems encountered by cocos2d-x
随机推荐
马斯克发布人形机器人,AI对马斯克为什么意义重大?
简单的恶意样本行文分析-入门篇
深度学习——几种学习类型
Openmmlab environment configuration
Classification of gbase 8s locks
Record small knowledge points
Nodejs 通过Heidisql连接mysql出现ER_BAD_DB_ERROR: Unknown database 'my_db_books'
GBASE 8s的包
php封装curl发送get、post请求方法,并使用
坐标系左乘右乘
CTF_ Web: Advanced questions of attack and defense world expert zone WP (15-18)
Gbase 8s overall architecture
Gbase 8s parallel operation problem scenario description
Finereport (sail soft) handling the problem that the histogram data label is blocked
Retrofit 源码分析
如何筛选出和产品相关的词,精准排除掉无效词
Gbase 8s stored procedure syntax structure
@Requestbody solution get parameter is null
Leetcode points to the leetcode road of offering II 091 house painting [dynamic planning] heroding
cnpm : 无法加载文件 C:\Users\Administrator\AppData\Roaming\npm\cnpm.ps1,因为在此系统上禁止运行脚本。