Acid characteristics required for database transactions __ Database

Source: Internet
Author: User
Database transactions must have acid properties, and acid is an abbreviation for atomic (atomicity), consistency (consistency), isolation (isolation), and durability (persistence).

Atomicity: The entire database transaction is an indivisible unit of work. The entire transaction succeeds only if all operations in the library are executed successfully, and if any SQL statement in the transaction fails, then the SQL statement that has executed successfully must also be revoked, and the database state should be returned to the state before the transaction was performed.
Consistency: A database transaction cannot disrupt the completion of relational data and the consistency of business logic. For example, a bank transfer transaction, whether successful or unsuccessful, should ensure that the total deposit of Tom and Jack in the accounts table after the end of the transaction is 2000 yuan.
Isolation: In a concurrent environment, when different transactions manipulate the same data at the same time, each transaction has its own full data space.
Persistence: It means that as soon as a transaction completes successfully, its update to the database must be permanently preserved. Even if a system crash occurs, the database can revert to its state at the end of the successful transaction after restarting the database system.

The (ACID) characteristics of a transaction are implemented by a relational database management system (RDBMS, database System). The database management system uses logs to ensure the atomicity, consistency, and durability of transactions. Log notes
The update of a transaction on the database is recorded, and if an error occurs during the execution of a transaction, the transaction's update to the database can be undone based on the log, so that the database is returned to its initial state before the transaction is performed.

The database management system adopts the lock mechanism to realize the separation of the transaction. When more than one transaction updates the same data in the database, only the transaction that holds the lock can update the data, and other transactions must wait until the previous transaction releases the lock, and other transactions have the opportunity to update the data.

Reprint: holdbelief.iteye.com/blog/216639

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.