Database is often asked to add, delete, change, check + transaction, there is an old saying is that there is a river’s lake where there is someone, in fact, there is a lock where there is a transaction, transaction is actually a kind of security, the following about several isolation levels of transaction, read not submitted, read submitted, can repeat read, serialization
1 Read not submitted
This is the lowest transaction isolation, AB two transactions, A transaction executes, modify the data, but did not submit data, then B transaction querying data, he can query to A transaction has not submitted data, then A transaction error was rolled back, B read data is A problem at this moment, this phenomenon is dirty reads.
2 Read submitted
B transaction can only read A transaction is submitted data, thus avoiding the dirty read, but if the transaction is executed at B query data possible query twice, do not match the data query, this is not repeatable read, may also occur B transaction of A phase data query twice, but two query the total number of different, this is the phantom read, there are some problems
3 Repeat
This is on the basis of read committed, B transaction query twice twice the query result is the same, but still inevitable phantom read
4 Serializable
In this case, a table lock is added and everyone queues up to read, so that dirty reads, phantom reads, and unreread reads are handled, but not high concurrency.
Mysql’s default isolation level is repeatable reads, but Oracle only has two isolation levels, read committed and serializable. Oracle’s default isolation level is read committed, which means that if you want to avoid this, you have to do something in your code