Database Transaction Features ACID

Source: Internet
Author: User
Transaction is the basic unit of concurrency control. A transaction is a sequence of operations. These operations are either executed or not executed. It is an inseparable unit of work. For example, for bank transfer: If you deduct money from one account and add money to another account, either or both of these operations are executed. Database transactions must have

Transaction is the basic unit of concurrency control. A transaction is a sequence of operations. These operations are either executed or not executed. It is an inseparable unit of work. For example, for bank transfer: If you deduct money from one account and add money to another account, either or both of these operations are executed. Database transactions must have

Transaction is the basic unit of concurrency control.

A transaction is a sequence of operations. These operations are either executed or not executed. It is an inseparable unit of work. For example, for bank transfer: If you deduct money from one account and add money to another account, either or both of these operations are executed.

Database transactions must have ACID properties. ACID is the abbreviation of Atomic (Atomicity), Consistency (Consistency), Isolation (Isolation), and Durability (Durability.

Atomicity: indicates that the entire database transaction is an inseparable unit of work. The transaction is successful only when all operations in the database are successfully executed. If any SQL statement in the transaction fails to be executed, the successfully executed SQL statement must also be revoked, the database status should be returned to the status before the transaction is executed.

Consistency: database transactions cannot undermine the integrity of relational data and business logic consistency. For example, for a bank transfer transaction, whether the transaction succeeds or fails, you should ensure that the total deposits of Tom and Jack in the ACCOUNTS table after the transaction ends is 2000 yuan.

Isolation: In a concurrent environment, when different transactions manipulate the same data at the same time, each transaction has its own complete data space. Modifications made by a concurrent firm must be isolated from those made by any other concurrent firm. When a transaction views data updates, the status of the data is either the status before another transaction modifies it, or the status after another transaction modifies it,Transactions do not view data in the intermediate state..

Persistence: the update made to the database must be permanently saved as long as the transaction ends successfully. Even if the system crashes, after the database system is restarted, the database can be restored to the State at the end of the transaction.

The ACID feature of transactions is implemented by relational database management systems (RDBMS. Database Management System collectionUse logs to ensure the atomicity, consistency, and durability of transactions. The log records the updates made by the transaction to the database. If an error occurs during the execution of a transaction, you can cancel the updates made to the database by the transaction according to the log, returns the database to the initial state before the transaction is executed.

Database Management SystemUse locks to isolate transactions. When multiple transactions update the same data in the database at the same time, only the transaction holding the lock can update the data. Other transactions must wait until the lock is released for the previous transaction, other transactions have the opportunity to update the data.


Source: http://www.cnblogs.com/younes/archive/2010/09/09/1822436.html

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.