当前位置:网站首页>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 .
边栏推荐
- XA Transaction SQL Statements
- 并网逆变器PI控制(并网模式)
- 【虚幻】过场动画笔记
- 在SQL注入中,为什么union联合查询,id必须等于0
- Mobile mall app solution: how much is it to make an app? Detailed explanation of APP mall development content
- PI control of three-phase grid connected inverter - off grid mode
- BugkuCTF-web24(解题思路及步骤)
- Fragmenttabhost implements the interface of housing loan calculator
- 三相逆变器离网控制——PR控制
- 2837xd Code Generation - Supplement (1)
猜你喜欢

Bugkuctf-web24 (problem solving ideas and steps)

一次聊天勾起的回忆

Save video opencv:: videowriter

Matlab代码生成之SIL/PIL测试

【虚幻】按键开门蓝图笔记

Illusion -- Animation blueprint, state machine production, character walking, running and jumping action

【虚幻】武器插槽:拾取武器

2837xd代码生成模块学习(4)——idle_task、Simulink Coder

【虚幻】自动门蓝图笔记

Record the interesting process of using Xray for the first time
随机推荐
How does {} prevent SQL injection? What is its underlying principle?
ZK configuration center -- configuration and use of config Toolkit
三相逆变器离网控制——PR控制
Attack and defense world web advanced area unserialize3
分享一篇博客(水一篇博客)
Alibaba cloud Prometheus monitoring service
Image recognition - Data Acquisition
go语言入门
2837xd 代码生成——补充(1)
图像识别-数据采集
PI control of three-phase grid connected inverter - off grid mode
2837xd 代码生成——StateFlow(1)
Is the C language too fat
Image recognition - Data Cleaning
Save video opencv:: videowriter
XA Transaction SQL Statements
QT信号槽总结-connect函数错误用法
2837xd code generation - stateflow (4)
2837xd 代码生成——补充(2)
保存视频 opencv::VideoWriter