Home > Database > Mysql Tutorial > Introduction to the four transaction isolation levels of mysql database

Introduction to the four transaction isolation levels of mysql database

不言
Release: 2019-03-04 15:20:33
forward
2408 people have browsed it

This article brings you an introduction to the four transaction isolation levels of the MySQL database. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

Familiar with the four transaction isolation levels of mysql database:

(Related recommendations: MySQL tutorial)

Query the transaction isolation level in mysql

SELECT @@tx_isolation;
Copy after login

Introduction to the four transaction isolation levels of mysql database

read uncommitted (RU) read uncommitted:

In one transaction, you can read uncommitted changes of other transactions

read committed ( RC) read committed:

In one transaction, you can read changes that have been committed by other transactions

repetable read, (RR) repeatable read:

a transaction , until the end of the transaction, you can repeatedly read the data seen at the beginning of the transaction without changing
The default isolation level of mysql is RR
The difference between RR and RC is that RR isolation is used in a transaction The data read from a table is the same at all levels

##insert into a(...)select * from a
Transaction A Transaction B
begin;
select * from a



Under the RR isolation level: Transaction A’s secondary select query The result is the same, you cannot see the data inserted in transaction B

Under the RC isolation level: the second select query of transaction A can see the data inserted in transaction B

serializable (serial read ):

Even if each read requires a table-level shared lock, and each write requires a table-level exclusive lock, reading and writing between the two sessions will block each other.

The above is the detailed content of Introduction to the four transaction isolation levels of mysql database. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:segmentfault.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template