Transaction, transactions
Transaction Features (isolation level) A: atomicity. Transactions are an inseparable unit. C: consistency. transactions must change the database from a consistent state to another consistent state. (For example, transfer) * I: isolation. One transaction cannot be disturbed by other transactions. D: persistence. Once a transaction is committed, it should be permanently saved. Isolation-level classification: read uncommitted: dirty reads, non-repeated reads, and virtual reads are all possible. Read committed: it can avoid dirty reads and avoid repeated reads and virtual reads. Repeatable read: avoids dirty reads and non-repetition. Virtual reads may occur. SERIALIZABLE: avoids dirty reads, non-repetition, and virtual reads. If you do not consider the isolation level of the transaction, the following "Incorrect" occurs: Dirty read: the transaction reads uncommitted data from the other transaction. Repeatable read: for a record, the number of records read before and after the same record is different from that of virtual read (phantom read): for a table, the number of records read before and after is different. MySQL statements that control the transaction isolation level: select @ tx_isolation; // view the current transaction isolation level set transaction isolation level your level (one of four); // set the isolation level