当前位置:网站首页>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 .
边栏推荐
- Int to string, int to qstring
- Navicat remote connection MySQL reports an error 1045 - access denied for user 'root' @ '222.173.220.236' (using password: yes)
- Creation and jump of activity
- Bugkuctf-web16 (backup is a good habit)
- 职业规划和发展
- How does {} prevent SQL injection? What is its underlying principle?
- 2837xd code generation module learning (4) -- idle_ task、Simulink Coder
- UE5——AI追逐(藍圖、行為樹)
- Share a blog (water blog)
- Minimum number of C language
猜你喜欢

2837xd Code Generation - Supplement (1)

ESLint 报错

YOLO物体识别,生成数据用到的工具

Large neural networks may be beginning to realize: the chief scientist of openai leads to controversy, and everyone quarrels

Attack and defense world web advanced area unserialize3

Kinect DK obtains color RGB images in cv:: mat format (used in openpose)

Alibaba cloud Prometheus monitoring service

个人经历&&博客现状

MySQL default transaction isolation level and row lock

逆变器simulink模型——处理器在环测试(PIL)
随机推荐
kinect dk 获取CV::Mat格式的彩色RGB图像(openpose中使用)
UE4夜间打光笔记
阿里云SLS日志服务
Introduction et prévention des essais de pénétration
分享一篇博客(水一篇博客)
Mixed development of uni app -- Taking wechat applet as an example
Image recognition - data annotation
图像识别-数据标注
C language programming problems
Memories of a chat
[ue5] animation redirection: how to import magic tower characters into the game
Introduction and prevention of penetration test
Is the C language too fat
High level application of SQL statements in MySQL database (II)
2837xd code generation - stateflow (4)
Matlab generates DSP program -- official routine learning (6)
2837xd 代码生成——补充(3)
Personal experience & blog status
2837xd 代码生成——总结篇
2837xd Code Generation - Supplement (1)