当前位置:网站首页>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 .
边栏推荐
- EasyRecovery15非常好用的电脑数据恢复软件
- Laravel document sorting 4. Controller
- navicat可不可以直接操作安卓数据库SQLite
- 2021.4.15 note the difference between let, const and VaR in ES6
- Summary of various problems encountered by cocos2d-x
- How much do you know about the use value of WMS warehouse management system
- Gbase 8s stored procedure syntax structure
- A-table mouse over the display hand, the current line can be clicked
- Introduction to intstream API
- JS arrow function
猜你喜欢

1. Phase II of the project - user registration and login

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

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

UCLA | 用于黑盒优化的生成式预训练

小白学习MySQL - 统计的'投机取巧'

"Comment positionner l'industrie" dans la planification industrielle locale / parc

Failed to install redis interface

冰冰学习笔记:循环队列的实现

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

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)
随机推荐
GBASE 8s存储过程流程控制
English Grammar - pronunciation rules
sql_ mode=only_ full_ group_ By's pit
The yii2 debug toolbar is missing
论文笔记: 多标签学习 ESMC (没看懂, 还没写出来, 暂时放这里占个位置)
CTF_ Web: file contains pseudo protocol with PHP
CTF_ Web: basic 12 questions WP of attack and defense world novice zone
[openwrt] we recommend a domestically developed version of openwrt, an introduction to istoreos. It is very easy to use. It is mainly optimized. It solves the problem of Sinicization.
Read lsd-slam: large scale direct monolithic slam
What is the storage engine and the three common database storage engines for MySQL
Coinlist how to operate the middle lot number security tutorial
2021.8.29 notes: register, bit operation, pointer, structure
CTF_ Web: deserialization learning notes (I) classes and objects in PHP
CTF_ Web: Advanced questions of attack and defense world expert zone WP (19-21)
Record small knowledge points
Error 1062 is reported during MySQL insertion, but I do not have this field.
记录小知识点
Laravel document sorting 3. CSRF protection
mysql的tinyint字段类型判断的疑惑
Summary of various problems encountered by cocos2d-x