Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the four transaction isolation levels of mysql database

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report