Isolation level of a database transaction
There are 4 isolation levels for database transactions, from low to high, READ UNCOMMITTED,Read Committed,Repeatable read, andSerializable, which can be resolved individually by each of the four levels Problems such as dirty reading, non-repetition reading, and Phantom reading.
1. READ UNCOMMITTED (not submitted)
The lowest isolation level. One transaction can read the results of an update that is not committed by another transaction.
2. Read Committed (Reading submit)
The default isolation level used by most databases. The result of an update operation for a transaction is that only after the transaction commits, another transaction can read the result after the same data update.
3. Repeatable read (repeat Read)
The default level for MySQL. During the entire transaction, the same data is read in the same way, regardless of whether the other transaction is updating the shared data or not, whether the update is committed or not.
4. Serializable
The highest isolation level. All transaction operations are executed sequentially. Note that this results in lower concurrency and the worst performance. It is usually replaced with a different concurrency level plus the corresponding concurrency lock mechanism.
Concurrency problems caused by two different transaction levels
1 Dirty Reads
Dirty reads occur when a transaction a reads a data that has been modified by another transaction B, but has not yet committed. If B is rolled back, transaction a reads invalid data. This is similar to non-repeatable reads, but the second transaction does not require a commit.
Database transaction ISOLATION LEVEL-Parse dirty Read & non-repeatable READ & Phantom Read