Things and isolation levels in Mysql
What do you mean business?
A transaction is a set of sql operations that either succeed or fail.
ACID attribute atomicity
A thing must be viewed as an indivisible minimum unit of work, and the entire transaction must either succeed or fail to roll back. For a thing, it is impossible to perform only some of its operations.
consistency (consistency)
A database is always transitioning from one consistent state to another. For example, a total of two updates, after the first update, the system crashed, and there will be no impact on the data, because the transaction has not been committed.
Isolation
Changes made by one transaction are invisible to other transactions until they are finally committed.
Durability
Once the transaction is committed, the changes are permanently saved to the database.
transaction isolation level
Problems with concurrent transactions:
dirty reads
Transactions can read uncommitted data, called dirty reads. unrepeatable reading
At the beginning of a transaction, only changes made by committed transactions can be read. In other words, any changes made to a transaction from the start until it commits are invisible to other transactions. Executing the same query twice may yield different results. phantom reading
When a transaction reads a range of records, another transaction inserts a new record in the range, and when the previous transaction reads the range of records again, it generates a phantom row. isolation level dirty read possibility non-repeatable read possibility phantom read possibility read uncommittedYesYesNorecommittedNoYesRepeatable readNoNoYesSerializableNoNo