This article introduces you to the four characteristics and meaning of database transactions. We can refer to the MySQL video tutorial and MySQL manual on the PHP Chinese website!
Four characteristics and meanings of database transactions
Four basic elements for the correct execution of database transaction transactions.
ACID
Atomicity
Atomicity: All operations in the entire transaction are either completed or not completed, and it is impossible to stagnate somewhere in the middle link. If an error occurs during the execution of the transaction, it will be rolled back to the state before the transaction started, as if the transaction had never been executed.
Consistency (Correspondence)
Consistency: Before the transaction starts and after the transaction ends, the integrity constraints of the database are not violated.
Isolation
Isolation: Execute transactions in an isolated state so that they appear to be the only operations performed by the system at a given time. If there are two transactions, running at the same time, execute With the same function, transaction isolation will ensure that each transaction in the system thinks that only that transaction is using the system. This property is sometimes called serialization. To prevent confusion between transaction operations, requests must be serialized or serialized. requests so that there is only one request for the same data at the same time.
Durability
Persistence: After the transaction is completed, the changes made by the transaction to the database are persisted in the database and will not be rolled back.
The above is the detailed content of Four characteristics and meanings of database transactions [detailed explanation]. For more information, please follow other related articles on the PHP Chinese website!