当前位置:网站首页>MySQL - isolation level of transactions

MySQL - isolation level of transactions

2022-06-10 00:58:00 Xiao Xian.

Recommended links :
     summary ——》【Java】
     summary ——》【Mysql】
     summary ——》【Spring】
     summary ——》【SpringBoot】

One 、 Isolation level definition for transactions

Transaction isolation level refers to the isolation degree of one transaction's modification of data from another parallel transaction .

Transaction isolation level describe Dirty reading It can't be read repeatedly Fantasy reading Lock reading
Uncommitted read read uncommitted A transaction can read uncommitted data of other transactions
Read committed read committed A transaction can only read the committed data of other transactions
Repeatable repeatable read A transaction reads the same data multiple times and the result is the same
Serializable serializable All transactions are executed serially , There is no concurrent operation of transactions

Q: The stricter the transaction isolation of the database, the better ?
A: The more strict the transaction isolation of the database , The smaller the concurrent side effects , But the more it costs , Because the essence of transaction isolation is to serialize transactions to a certain extent , You need to decide which isolation level to use according to your specific business needs

Q:oracle Only 2 Transaction isolation levels ?
A: Read committed read committed、 Serializable serializable

Q:Mysql There are several transaction isolation levels ?
A:4 All of them

Two 、Mysql innodb Default transaction isolation level

Default :REPEATABLE-READ

show VARIABLES like 'tx_isolation'

 Insert picture description here

Q:innodb Why use RR As the default transaction isolation level ?
A: because innodb stay RR The level of reading solves the problem of unreal reading .

3、 ... and 、Oracle Default transaction isolation level

Default :read-committed

原网站

版权声明
本文为[Xiao Xian.]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/161/202206100028434225.html