博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
数据库隔离级 ( Isolation level )
阅读量:5226 次
发布时间:2019-06-14

本文共 1950 字,大约阅读时间需要 6 分钟。

专业术语:

phantom reads[幻读] - Repeatable Reads Level:事务A的两次范围查询之间,事物B在范围插入了数据,导致事务A两次查询结果不一致(因为范围锁range-locks)

non-repeatable reads[重复读取不一致] - Read Committed Level:事务A对某一行进行两次查询,在这两次查询之间,事物B对这一行的数据进行了修改,导致事务A的两次查询结果不一致

dirty reads[脏读] - Read Uncommitted Level:事务A对某一行进行两次查询,在这两次查询之间,事物B对这一行的数据进行了修改,但是未提交而是回滚,导致事务A的第二次查询读取了错误的数据

隔离级:

Serializable [串行]

This is the highest isolation level.

With a lock-based  DBMS implementation,  requires read and write locks (acquired on selected data) to be released at the end of the transaction. Also range-locks must be acquired when a  query uses a ranged WHERE clause, especially to avoid the phantom reads phenomenon (see below).

When using , no locks are acquired; however, if the system detects a write collision among several concurrent transactions, only one of them is allowed to commit. See for more details on this topic.

Repeatable reads [重复读]

In this isolation level, a lock-based  DBMS implementation keeps read and write locks (acquired on selected data) until the end of the transaction. However, range-locks are not managed, so the phantom reads phenomenon can occur (see below).

Read committed [读提交]

In this isolation level, a lock-based  DBMS implementation keeps write locks (acquired on selected data) until the end of the transaction, but read locks are released as soon as the operation is performed (so the non-repeatable reads phenomenon can occur in this isolation level, as discussed below). As in the previous level, range-locks are not managed.

Read uncommitted [读未提交]

This is the lowest isolation level. In this level, dirty reads are allowed (see below), so one transaction may see not-yet-committed changes made by other transactions.

 

MySQL参数配置:

SET [GLOBAL | SESSION] TRANSACTION ISOLATION LEVEL{    REPEATABLE READ  | READ COMMITTED  | READ UNCOMMITTED  | SERIALIZABLE}

 

感觉其实看懂了还是非常好理解的,只是不太好描述~

 

参考文献:

[wiki]:

[MySQL]:

转载于:https://www.cnblogs.com/istrong/archive/2012/09/13/2684136.html

你可能感兴趣的文章
不错的MVC文章
查看>>
网络管理相关函数
查看>>
IOS Google语音识别更新啦!!!
查看>>
[置顶] Linux终端中使用上一命令减少键盘输入
查看>>
BootScrap
查看>>
CodeForces - 878A Short Program(位运算)
查看>>
路冉的JavaScript学习笔记-2015年1月23日
查看>>
Mysql出现(10061)错误提示的暴力解决办法
查看>>
2018-2019-2 网络对抗技术 20165202 Exp3 免杀原理与实践
查看>>
NPM慢怎么办 - nrm切换资源镜像
查看>>
Swift - UIView的常用属性和常用方法总结
查看>>
Swift - 异步加载各网站的favicon图标,并在单元格中显示
查看>>
Java编程思想总结笔记Chapter 5
查看>>
[LeetCode]662. Maximum Width of Binary Tree判断树的宽度
查看>>
【Python学习笔记】1.基础知识
查看>>
梦断代码阅读笔记02
查看>>
selenium学习中遇到的问题
查看>>
大数据学习之一——了解简单概念
查看>>
Linux升级内核教程(CentOS7)
查看>>
Lintcode: Partition Array
查看>>