RR 和RC隔离问题
Sesssion 1:
mysql> select @@tx_isolation;
+-----------------+
| @@tx_isolation |
+-----------------+
| REPEATABLE-READ |
+-----------------+
1 row in set (0.00 sec) mysql> use scan;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A Database changed
mysql> start transaction;
Query OK, 0 rows affected (0.00 sec) mysql> select * from t1;
+-------+
| c1 |
+-------+
| 33 |
| 34 |
| 87 |
| 89 |
| 100 |
| 999 |
| 88888 |
+-------+
7 rows in set (0.00 sec) Session 2:
mysql> select @@tx_isolation;
+-----------------+
| @@tx_isolation |
+-----------------+
| REPEATABLE-READ |
+-----------------+
1 row in set (0.00 sec) mysql> use scan;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A Database changed
mysql> start transaction;
Query OK, 0 rows affected (0.00 sec) mysql> select * from t1;
+-------+
| c1 |
+-------+
| 33 |
| 34 |
| 87 |
| 89 |
| 100 |
| 999 |
| 88888 |
+-------+
7 rows in set (0.00 sec) mysql> insert into t1 values(909090);
Query OK, 1 row affected (0.00 sec) mysql> commit;
Query OK, 0 rows affected (0.01 sec) Session 1再次查看:
mysql> select * from t1;
+-------+
| c1 |
+-------+
| 33 |
| 34 |
| 87 |
| 89 |
| 100 |
| 999 |
| 88888 |
+-------+
7 rows in set (0.00 sec) Session 1看不到 909090这条记录 切换到RC模式:
transaction-isolation =READ-COMMITTED Session 1:
mysql> select @@tx_isolation;
+----------------+
| @@tx_isolation |
+----------------+
| READ-COMMITTED |
+----------------+
1 row in set (0.00 sec) mysql> use scan;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A Database changed
mysql> start transaction;
Query OK, 0 rows affected (0.00 sec) mysql> select * from t1;
+--------+
| c1 |
+--------+
| 33 |
| 34 |
| 87 |
| 89 |
| 100 |
| 999 |
| 88888 |
| 909090 |
+--------+
8 rows in set (0.00 sec) Session 2:
mysql> use scan;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A Database changed
mysql> start transaction ;
Query OK, 0 rows affected (0.00 sec) mysql> select @@tx_isolation;
+----------------+
| @@tx_isolation |
+----------------+
| READ-COMMITTED |
+----------------+
1 row in set (0.00 sec) mysql> insert into t1 values(98989800);
Query OK, 1 row affected (0.00 sec) mysql> commit;
Query OK, 0 rows affected (0.01 sec) Session 1: 再次查看: mysql> select * from t1;
+----------+
| c1 |
+----------+
| 33 |
| 34 |
| 87 |
| 89 |
| 100 |
| 999 |
| 88888 |
| 909090 |
| 98989800 |
+----------+
9 rows in set (0.00 sec) 可以看到98989800 这条记录
RR 和RC隔离问题的更多相关文章
- Mysql rr和rc隔离
REPEATABLE READ This is the default isolation level for InnoDB. For consistent reads, there is an im ...
- MySQL--事务隔离级别RR和RC的异同
在MySQL中,事务隔离级别RC(read commit)和RR(repeatable read)两种事务隔离级别基于多版本并发控制MVCC(multi-version concurrency con ...
- RR 和RC 幻读问题
<pre name="code" class="html">显然 RR 支持 gap lock(next-key lock),而RC则没有gap l ...
- mysql rr和rc区别
<pre name="code" class="html">1. 数据库事务ACID特性 数据库事务的4个特性: 原子性(Atomic): 事务中的 ...
- 【MySQL 读书笔记】RR(REPEATABLE-READ)事务隔离详解
这篇我觉得有点难度,我会更慢的更详细的分析一些 case . MySQL 的默认事务隔离级别和其他几个主流数据库隔离级别不同,他的事务隔离级别是 RR(REPEATABLE-READ) 其他的主流数据 ...
- RR和RC复合语句加锁
mysql版本:5.7 RR复合语句: insert/update/delete+select,+号左边是影响数据的排他锁,+号右边是查询(当前读,其实相当于lock in share mode)到数 ...
- RC隔离 更新where条件列 没有索引的情况
CREATE TABLE `test100` ( `sn` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增编号', `phoneNo` int(11) , `c ...
- 一文彻底读懂MySQL事务的四大隔离级别
前言 之前分析一个死锁问题,发现自己对数据库隔离级别理解还不够清楚,所以趁着这几天假期,整理一下MySQL事务的四大隔离级别相关知识,希望对大家有帮助~ 事务 什么是事务? 事务,由一个有限的数据库操 ...
- 浅谈mysql mvcc
以下为个人理解,如有错误,还望指正!! mysql的大多数事务型存储引擎实现的都不是简单的行级锁,基于提升并发性能的考虑,他们一般都同时实现了多版本并发控制,可以认为MVCC是行级锁的一个变种,但是它 ...
随机推荐
- Dump 文件生成与分析
近期两天因为项目的须要,研究了一下Dump文件相关的知识,今天做一个小节(因为研究不久而且第一次写blog,希望网友们看到不要见笑). Dump文件是进程的内存镜像.能够把程序的运行状态通过调试器保存 ...
- hook研究结果备忘
hook研究结果: 最近一周时间仔细研究了一下hook,也许不能称之为研究吧.顶多是让别人的思想拿过来抄袭一遍而已,写点结果也算对得起自己的这几天的苦心了. 1,首先从同事旁边听到了hook,然后看的 ...
- 【JavaScript】我的JavaScript技术总结第一篇——编程细节
遍历数组 for (var i=0, l=arr.length; i<l; i++) 这样写的一个好处就是让每次循环少一步获取数组对象长度的操作,数组长度越长,价值越明显. 判断变量的真假 if ...
- java的通信机制
通信机制无非就那几种:http访问.socket访问: http又分为:jsp.servlet.html,用的就是get和post方法 socket则可分为:tcp或者udp方式 从以上内容又衍生出其 ...
- instanceof 和 构造函数
1. intanceof 运算符 instanceof 运算符返回一个布尔值,表示指定对象是否为某个构造函数的实例. instanceof左边是实例对象 右边是构造函数.它的运算实质是检查右边构建函数 ...
- python-property、docstring--笔记
已经有人总结的非常详细,而且写得不错,就直接贴过来用了 property作为装饰器函数,负责把一个方法变成属性调用的 廖雪峰关于property的讲解 http://www.liaoxuefeng.c ...
- asp.net服务器控件防止多次提交问题
用户可能点击多次提交按钮.这样,导致向数据库中插入了多条相同的记录. 好像这2个方法都是针对的服务器控件! //方法一:在提交时调用一段客户端的代码. function a() { document. ...
- Eclipse4.4安装旧版本插件报错 Failed to prepare partial IU
Failed to prepare partial IU: [R]com.googlecode.veloeclipse.ui 2.0.8. work around: go to Help -> ...
- 更新Xcode7 后 .dylib变成了.tbd的问题解决
拿添加libsqlite3.dylib为例 1.打开你添加的libsqlite3.tbd 文本文件,然后有一行 install-name: /usr/lib/libsqlite3.dylib ...
- 【cogs247】售票系统
[问题描述] 某次列车途经C个城市,城市编号依次为1到C,列车上共有S个座位,铁路局规定售出的车票只能是坐票, 即车上所有的旅客都有座.售票系统是由计算机执行的,每一个售票申请包含三个参数,分别用O. ...