<> What is? ACID?

ACID, Refers to the reliable database management system (DBMS) in , affair (transaction) Four characteristics that should be possessed : Atomicity (Atomicity), uniformity (Consistency), Isolation (Isolation), persistence (Durability). These are the characteristics of a reliable database . therefore ACID It is the abbreviation of these four characteristics .
* Atomicity (Atomicity)
Atomicity means that transactions in the database are executed as atoms . That is, it cannot be further divided , The entire statement is either executed , Either not .
stay SQL SERVER in , Each individual statement can be considered to be included in a transaction by default , Each statement is atomic in itself , Or do it all , This is not the case , There will be no intermediate state :
for example :

Bank transfer function , from A Account minus 100, stay B Account increase 100, If these two statements do not guarantee atomicity , For example, from A Account minus 100 after , Server power down , And in the B There was no increase in the account 100. Although this situation will make the bank happy , But as a developer, you don't want that to happen . In the default transaction , Even if there is an error, the whole transaction will not be rolled back . Instead, the failed statement throws an exception , The correct statement is executed successfully . This will destroy atomicity . therefore SQL
SERVER Some options are given to ensure the atomicity of the transaction .
* uniformity (Consistency)
Consistency is before the start of a transaction and after the end of a transaction , The integrity constraints of the database are not broken .
Consistency is reflected in two levels :
1. Database mechanism level
Consistency at the database level is , Before and after the execution of a transaction , The data will meet the constraints you set ( Unique constraint , Foreign key constraint ,Check Constraints, etc ) And trigger settings . This is due to SQL
SERVER Guaranteed .
2. Business level

For the business level , Consistency is business consistency . This business consistency needs to be guaranteed by developers . The consistency of many business aspects can be guaranteed by transferring to the database mechanism level . such as , There are only two models , Can be transferred to use CHECK The constraint requires that only these two models can be stored in a column .
* Isolation (Isolation)
Isolation . The execution of transactions does not interfere with each other , It is not possible for one transaction to see the other transaction runtime , Data at a certain time in the middle .
stay Windows in , If multiple processes modify the same file, it is not allowed ,Windows In this way, the isolation of different processes is guaranteed , and SQL Server in , adopt SQL
SERVER Manage the database files , This allows multiple processes to access the database at the same time :SQL Server Locking and blocking are used to ensure the isolation of different levels between transactions .
Normally , Complete isolation is unrealistic , Complete isolation requires the database to execute only one transaction at a time , Such performance can be imagined . Want to understand SQL
Server Protection of isolation in China , First, understand how transactions interfere . There are several types of interactions between transactions , Respectively : Dirty reading (Dirty Read), Non repeatable , Illusory reading .
* persistence (Durability)
persistence , After the transaction is completed , The changes made by the firm to the database are persisted in the database , It will not be rolled back .
Even if there is any accident, such as power failure , Once the transaction is committed , The persistence is stored in the database .

©2019-2020 Toolsou All rights reserved,
The 11th Blue Bridge Cup python The real topic of the University Group National Games JavaSwing To achieve a simple Lianliankan games 【Spring Source code analysis 】42-@Conditional Detailed explanation element-ui Step on pit record 2019PHP Interview questions ( Continuously updated )PHPJava Misunderstanding —— Method overloading is a manifestation of polymorphism ? First issue 500 100 million , Set up a new Department , What is Tencent going to do ? Google chrome The browser can't open the web page , But what if other browsers can open it ? Regression of dependent variable order categories (R language )【Golang Basic series 10 】Go language On conditional sentences if