MySQL database transaction detailed

Source: Internet
Author: User

80 mid-year marriage four pieces: watches, bicycles, sewing machine, radio (three Turn One Ring). It takes four things to get a business home, so the business is mean (ACID), four-piece list: atomicity ( Atom), consistency (Consistent), Isolation (Isolate), persistence (D urable). acid is the abbreviation for the four basic elements that a database transaction performs correctly.

    1. Atomicity: Either don't talk, want to talk about getting married!

For their data modifications, either all are executed, or none are executed. If the system only performs a subset of these operations, it may break the overall goal of the transaction. The most typical problem is the bank transfer problem.

    1. Consistency: How to love me when I'm in love;

What kind of constraints the database has, and the need for such a constraint after the transaction is executed, all rules must be applied to the modification of the transaction to maintain the integrity of all the data. At the end of a transaction, all internal data structures (such as B-tree indexes or doubly linked lists), integrity constraints (indexes, primary keys) must be consistent.

    1. Isolation: After the bridal chamber, it is two people's private affairs.

The state in which the data is located when the transaction is viewing the data, either when another concurrent transaction modifies its state or after another transaction modifies it, and the transaction does not view the data in the middle state. The highest isolation level is obtained when the transaction is serializable. Isolation is relatively complex in the transaction mechanism, as described below.

    1. Persistence: Once the marriage certificate has been brought, cannot regret.

Modifications are maintained even if a fatal system failure occurs. Do not tell me the system said that the commit succeeded, the phone back to tell me that the server room power outage, my transaction involves the data modification may not enter the database.

MySQL database transaction detailed

Related Article

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.