Transaction characteristics (ACID) and transaction concurrent operation problems

1. Characteristics of the transaction (ACID)

  A. Atomicity (A): SQL statements are either fully executed or not executed, which is the core feature of transactions;

  B. Consistency (C): Consistency means that the integrity of the database has not been destroyed after the execution of the transaction, and the data remains legal;

     Atomicity, durability, and isolation ultimately contribute to consistency

  C .. Isolation (I): At the same time, only one transaction is allowed to request the same data, and different transactions do not interfere with each other;

    Unlike other features, the focus is on the research transaction itself, and isolation studies the interaction between different transactions

  D. Durability (D): is the guarantee of the transaction, the sign of the end of the transaction (the data in the memory is persisted to the hard disk file).

2. Transaction concurrent operation problems (by default: phantom reads are allowed, dirty reads are not allowed, and non-repeatable reads)

  A. Dirty read: The current transaction (A) can read uncommitted data (dirty data) of other transactions (B), this phenomenon is dirty read

  B. Non-repeatable read: The same data is read twice in transaction A, and the results of the two reads are different. This phenomenon is called non-repeatable read.

  C. Magic read: In transaction A, the database is queried twice according to a certain condition, and the number of results of the two queries is different. This phenomenon is called magic read.

Guess you like

Origin www.cnblogs.com/dyxg/p/12714030.html