【事务隔离级别】数据库事务隔离级别-UNDERSTANDING ISOLATION LEVELS
参考链接:ISOLATION LEVELS
ISOLATION LEVELS
In a database system, concurrent transactions are processed in “isolation” from each other. The level of isolation determines how transactions can affect each other.
UNDERSTANDING ISOLATION LEVELS
READ-UNCOMMITTED
Here transactions can see changes to data made by other transactions that are not yet committed.
In other words, transactions can read data that eventually may not exist, given that other transactions can always rollback the changes without commit. This is known as a dirty read. Effectively, READ-UNCOMMITTED has no real isolation at all.
- 事务A可以读取到事务B还未 commit的数据
- 若事务B回滚数据,则事务A将产生
脏读
READ-COMMITTED
Here dirty reads are not possible. Uncommitted changes remain invisible to other transactions until the transaction commits.
However, at this isolation level SELECT queries use their own snapshots of committed data, that is data committed before the SELECT query executed. As a result, SELECT queries, when run multiple times within the same transaction, can return different result sets. This is called a non-repeatable read.
- 事务A不可以读取到事务B还未 commit的数据,即:未commit的数据,对其他事务不可见;
- 不会产生
脏读 - 同一事务的多次select查询,使用的数据快照可能不同,因此查询结果可能不同,即:
不可重复读;
REPEATABLE-READ
Here non-repeatable reads are not possible. Snapshots taken for the SELECT query are taken the first time the SELECT query runs during the transaction.
The snapshot remains in use throughout the entire transaction for the SELECT query. It always returns the same result set. This level does not take into account changes to data made by other transactions, regardless of whether or not they have been committed. IN this way, reads remain repeatable.
- 不会产生
脏读和不可重复读问题 - 同一事务的多次select查询,使用的数据快照相同,都使用第一次select时的数据快照,而不管其他是否有没有commit更新;
SERIALIZABLE
Here all records accessed within a transaction are locked. The resource locks in a way that also prevents you from appending records to the table the transaction operates upon.
SERIALIZABLE prevents a phenomenon known as a phantom read. Phantom reads occur when, within a transaction, two identical queries execute, and the rows the second query returns differ from the first.
- 不会产生幻影读(不确定)
【事务隔离级别】数据库事务隔离级别-UNDERSTANDING ISOLATION LEVELS的更多相关文章
- 数据库事务隔离级ORACLE数据库事务隔离级别介绍
本文系转载,原文地址:http://singo107.iteye.com/blog/1175084 数据库事务的隔离级别有4个,由低到高依次为Read uncommitted.Read committ ...
- redis事务与关系型数据库事务比较
redis 是一个高性能的key-value 数据库.作为no sql 数据库redis 与传统关系型数据库相比有简单灵活.数据结构丰富.高速读写等优点. 本文主要针对redis 在事物方面的处理与传 ...
- Spring的事务管理和数据库事务相关知识
1 初步理解 理解事务之前,先讲一个你日常生活中最常干的事:取钱. 比如你去ATM机取1000块钱,大体有两个步骤:首先输入密码金额,银行卡扣掉1000元钱:然后ATM出1000元钱. ...
- Spring事务传播及数据库事务操作
从Spring 事务配置说起 先看看Spring 事务的基础配置 <aop:aspectj-autoproxy proxy-target-class="true"/> ...
- Cassandra事务与关系型数据库事务有何区别
Cassandra不会使用回滚和锁机制来实现关系型数据的ACID事务,相比较于提供原子性,隔离性和持久化,Cassandra提供最终(可调节的)一致性,让用户决定为每个事务提供强一致性或者最终一致性. ...
- 通过pymysql程序debug学习数据库事务、隔离级别
问题 今天在使用pymysql连数据库的时候,出现了一个bug,查询数据库某个数据,但是在我在数据库中执行sql语句改变数据后,pymsql的查询依然没有发生改变. 代码如下: # 5.6.10 co ...
- 数据库事务隔离级别 - 分析脏读 & 不可重复读 & 幻读
一 数据库事务的隔离级别 数据库事务的隔离级别有4个,由低到高依次为Read uncommitted .Read committed .Repeatable read .Serializable ,这 ...
- 数据库事务 ACID属性、数据库并发问题和四种隔离级别
数据库事务 ACID属性.数据库并发问题和四种隔离级别 数据库事务 数据库事务是一组逻辑操作单元,使数据从一种状态变换到另一种状态 一组逻辑操作单元:一个或多个DML操作 事务处理原则 保证所有事务都 ...
- spring 中常用的两种事务配置方式以及事务的传播性、隔离级别
一.注解式事务 1.注解式事务在平时的开发中使用的挺多,工作的两个公司中看到很多项目使用了这种方式,下面看看具体的配置demo. 2.事务配置实例 (1).spring+mybatis 事务配置 &l ...
随机推荐
- SLES12SP2使用总结
1. 设置hostname hostnamectl set-hostname hostname***
- 利用selenium模拟登录webqq
from selenium import webdriver import selenium.webdriver.support.ui as ui import time opt = webdrive ...
- CodeForces - 710F:String Set Queries (二进制分组 处理 在线AC自动机)
ou should process m queries over a set D of strings. Each query is one of three kinds: Add a string ...
- matlab学习(2) sort、sortrows
1.sort函数 对于向量,sort(X)把向量的元素按照从小到大排序: 对于矩阵,sort(X)按照从小到大顺序对矩阵每一列进行排序:sort(X,2)按照行排序 对于字符串的元胞数组,sort(X ...
- Spring Boot 揭秘
SpringBoot基础 微服务 解决大一统的服务化架构的问题 代码冲突问题 交付复杂,影响面大 测试困难 微服务的好处 可扩展性 隔离性 灵活性,多语言多技术生态 微服务的挑战 保持微服务的互通性 ...
- Linux命令对应英文全称
https://blog.csdn.net/yrc_note/article/details/72598780 拓展:https://blog.csdn.net/u010613363/article/ ...
- 【NOI2014】【BZOJ3669】【UOJ#3】魔法森林
我学会lct辣 原题: 为了得到书法大家的真传,小E同学下定决心去拜访住在魔法森林中的隐士.魔法森林可以被看成一个包含个N节点M条边的无向图,节点标号为 1…n1…n,边标号为1…m1…m.初始时小E ...
- UVA11077 Find the Permutations
题意 PDF 给出1~n的一个排列,可以通过一系列的交换变成{1,2,-,n}.比如{2,1,4,3}需要两次交换.给定n和k,统计有多少个排列至少需要k次交换才能变成{1,2,-,n}. 分析 将给 ...
- Centos6.7 64位安装配置kvm虚拟化
首先,需要我们的cpu支持虚拟化,有的机器支持但是并未在bios开启,这个需要事先开启. 1. Dell R710安装centos6.7 64位 ,Dell R710在开机后按F2进入BIOS,Pro ...
- cocos2d-x游戏开发 跑酷(三) 人物跑动
原创.转载请注明出处:http://blog.csdn.net/dawn_moon/article/details/21245881 好吧.最终要跑起来了. 要实现跑酷须要用到帧动画,什么是帧动画,不 ...