Home > Database > Mysql Tutorial > body text

mysql advanced (twenty-three) four major characteristics of database transactions

黄舟
Release: 2017-02-11 10:49:36
Original
1980 people have browsed it

Four major characteristics of database transactions

Atomicity, consistency, separation, and durability

Atomicity

The atomicity of a transaction means that the program included in the transaction serves as the logical unit of work of the database, and all data modification operations it performs are either performed or not performed at all. This property is called atomicity.

The atomicity requirement of a transaction is that if a transaction can be regarded as a program, it will either be completely executed or not executed at all. That is to say, the operation sequence of the transaction is either completely applied to the database or does not affect the database at all. This property is called atomicity.

If the user completes updates to the database within a transaction, all updates must be visible to the outside world, or there may be no updates at all. The former says that the transaction has been committed, and the latter says that the transaction has been canceled (or aborted). The DBMS must ensure that all operations completed by successfully committed transactions are fully reflected in the database, while failed transactions have no impact on the database at all.

Consistency

Transaction consistency means that the database must be in a consistent state before and after a transaction is executed. This property is called transactional consistency. A database is said to be consistent if its state satisfies all integrity constraints.

Consistency handles the protection of all semantic constraints in the database. For example, when the database is in the consistency state S1, a transaction is executed on the database. During the execution of the transaction, the state of the database is assumed to be inconsistent. When the transaction execution ends, the database is in the consistency state S2.

Separation

Separation means that concurrent transactions are isolated from each other. That is, the operations within a transaction and the data being operated must be blocked and cannot be seen by other transactions attempting to modify it.

Separability is the security guarantee provided by DBMS against conflicts between concurrent transactions. DBMS can provide different levels of separation between concurrently executing transactions through locking. If there is no control over the execution of concurrent transactions, the execution of multiple concurrent transactions manipulating the same shared object may cause abnormal conditions.

DBMS can provide different levels of separation between concurrently executing transactions. There is an inverse relationship between the level of separation and the throughput of concurrent transactions. More transaction separability may lead to higher conflicts and more transaction abortions. Aborted transactions consume resources, and these resources must be accessed again. Therefore, a DBMS that ensures a high level of separation requires more overhead.

Persistence

Durability means ensuring that updates to committed transactions are not lost when a system or media failure occurs. That is, once a transaction is committed, the DBMS ensures that its changes to the data in the database should be permanent and withstand any system failure. So, durability mainly lies in the recovery performance of DBMS. Durability is guaranteed through database backup and recovery.

Reference materials

http://www.php.cn/

The above are the four major database transactions of mysql advanced (twenty-three) Feature content, please pay attention to the PHP Chinese website (www.php.cn) for more related content!


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!