当前位置:网站首页>Database -- acid of transaction -- introduction / explanation
Database -- acid of transaction -- introduction / explanation
2022-07-02 10:01:00 【It blade out of sheath】
brief introduction
This article introduces the transaction of database ACID.
The transaction is ACID Four features : Atomicity (Atomic)、 Uniformity (Consistent)、 Isolation, (Isolation)、 persistence (Duration).
Atomicity (Atomic)
explain
Transaction must be atomic unit of work , Modify the data , All or nothing , All or nothing .
Uniformity (Consistent)
explain
The transaction is completed , All data must be kept consistent .
Example
user A And the user B The sum of the two is 700, No matter A and B How to transfer money between banks , The money of two users must add up to 700, This is consistency .
Isolation, (Isolation)
explain
Changes made by concurrent transactions must be isolated from changes made by any other concurrent transactions .
Detailed explanation
In a concurrent environment , When different transactions manipulate the same data at the same time , Each transaction has its own full data space . Changes made by concurrent firms must be isolated from changes made by any other concurrent firms .
When transactions view data updates , The state of the data is either the state of another transaction before it was modified , Or another transaction changes its state , Transactions do not see data in the intermediate state .
persistence (Duration)
explain
After the transaction completes , The status change of the corresponding data in the database should be Permanence Of , It will not be rolled back .
Detailed explanation
If the transaction has been committed , But data is also persistent , At this time, the system is powered off or down , You can also re operate the non persistent data according to the transaction log , Put it recovery To the state that the transaction ends successfully .
Pre written logs (Write-ahead logging, abbreviation WAL) Mechanism
Many databases use pre written logs (Write-ahead logging, abbreviation WAL) Mechanism , To ensure transaction persistence and data integrity , At the same time, the frequent data refresh based on transactions is avoided to a great extent IO Impact on performance .
In the use of WAL In the system , All changes are written to the log first , Then it is applied to the system state . Let's say a program loses power while it's doing something . On reboot , The program may need to know whether the operation performed at that time was successful or partially successful or failed . Program can check log file , Compare the planned operation content with the actual operation content in case of sudden power failure . On the basis of this comparison , The program can then decide whether to undo the action or continue to complete the action , Or keep it as it is .
边栏推荐
- Junit5 supports suite methods
- UE4夜间打光笔记
- Judging right triangle in C language
- Required request body is missing: (cross domain problem)
- 攻防世界-Web进阶区-unserialize3
- 2837xd code generation - stateflow (1)
- 2837xd代码生成模块学习(3)——IIC、eCAN、SCI、Watchdog、eCAP模块
- Fragmenttabhost implements the interface of housing loan calculator
- 【UE5】蓝图制作简单地雷教程
- 三相逆变器离网控制——PR控制
猜你喜欢
随机推荐
在SQL注入中,为什么union联合查询,id必须等于0
QT qlabel style settings
A model can do two things: image annotation and image reading Q & A. VQA accuracy is close to human level | demo can be played
攻防世界-Web进阶区-unserialize3
C language strawberry
MySQL transaction
阿里云ack介绍
Blender多镜头(多机位)切换
C语言之数据插入
2837xd 代码生成——StateFlow(4)
The latest progress and development trend of 2022 intelligent voice technology
C language programming problems
上班第一天的报错(AWVS卸载不彻底)
阿里云短信服务
【UE5】AI随机漫游蓝图两种实现方法(角色蓝图、行为树)
Minimum number of C language
2837xd 代码生成——补充(3)
分享一篇博客(水一篇博客)
图像识别-数据标注
一次聊天勾起的回忆








