Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the four basic elements for the correct execution of database transactions?

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces to you what are the four basic elements of the correct execution of database transactions, the content is very detailed, interested friends can refer to, hope to be helpful to you.

ACID is an acronym for the four basic elements of the correct execution of database transactions, namely, Atomicity, Consistency, Isolation, and Durability. A database system that supports Transaction must have ACID characteristics, otherwise the correctness of the data can not be guaranteed in the transaction process (Transaction processing), and the transaction process may not meet the requirements of the trader.

Atomicity (Atomicity)

-all operations of the transaction are either completed or not completed, and will not end in some intermediate link.

Consistency (Consistency)

-before the transaction starts and after the transaction ends, the database integrity limit is not broken.

Isolation (Isolation)

-the interrelationship shown when multiple transactions access the same data in the database concurrently.

Persistence (Durability)

-after the transaction is completed, the changes made by the transaction are persisted and will not be lost.

1. Atomicity

All the operations in the whole transaction are either completed or not completed, and it is impossible to stagnate in the middle. An error occurs during the execution of a transaction and is Rollback back to its state before the transaction starts, as if the transaction had never been executed.

two。 Consistency

Before the transaction starts and after the transaction ends, the integrity constraints of the database are not broken.

3. Isolation

Transactions are executed 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 that run at the same time and perform the same function, the isolation of the transaction ensures that each transaction is thought to be the only transaction in the system that is using the system.

This attribute is sometimes called serialization, and to prevent confusion between transaction operations, requests must be serialized or serialized so that only one request is used for the same data at a time.

4. 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.

Because an operation usually contains many sub-operations, and these sub-operations may cause problems due to hardware damage or other factors, it is not easy to implement ACID correctly. ACID recommends that the database operate all the data that needs to be updated and modified at once, but it is not feasible in practice.

At present, there are two main ways to implement ACID: the first is Write ahead logging, that is, log-like way. The second is Shadow paging.

What are the four basic elements of the correct execution of database transactions? so much for sharing here. I hope the above content can help you to some extent and learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report