What are the four transaction isolation levels of mysql database
This article mainly introduces the mysql database four transaction isolation level is what, has a certain reference value, the need for friends can refer to. I hope you all have a lot of success after reading this article. Let's take a look at it together.
Familiar with the four transaction isolation levels of mysql database:
Query transaction isolation level in mysql
SELECT @@tx_isolation;
read uncommitted (RU):
In a transaction, you can read uncommitted changes from other transactions.
read committed (RC) Read committed:
In a transaction, changes committed by other transactions can be read.
Repeatable read (RR):
In a transaction, until the end of the transaction, you can repeatedly read the data you just saw at the beginning of the transaction, and there will be no change.
The default isolation level for mysql is RR
The difference between RR and RC is that in a transaction RR isolation level reads a table data is the same
transaction A transaction B begin;
select * from a
insert into a(...) select * from a
RR isolation level: transaction A twice select query results are the same, do not see the data inserted in transaction B
RC isolation level: transaction A second select query is able to see the inserted data in transaction B
serializable:
Even if a table-level shared lock is required for each read and a table-level exclusive lock is added for each write, reads and writes between the two sessions block each other.
Thank you for reading this article carefully. I hope Xiaobian can share what the four transaction isolation levels of mysql database are to help everyone. At the same time, I hope that everyone will support you more, pay attention to the industry information channel, find out if you encounter problems, and find detailed solutions waiting for you to learn!