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隔离问题的更多相关文章

  1. Mysql rr和rc隔离

    REPEATABLE READ This is the default isolation level for InnoDB. For consistent reads, there is an im ...

  2. MySQL--事务隔离级别RR和RC的异同

    在MySQL中,事务隔离级别RC(read commit)和RR(repeatable read)两种事务隔离级别基于多版本并发控制MVCC(multi-version concurrency con ...

  3. RR 和RC 幻读问题

    <pre name="code" class="html">显然 RR 支持 gap lock(next-key lock),而RC则没有gap l ...

  4. mysql rr和rc区别

    <pre name="code" class="html">1. 数据库事务ACID特性 数据库事务的4个特性: 原子性(Atomic): 事务中的 ...

  5. 【MySQL 读书笔记】RR(REPEATABLE-READ)事务隔离详解

    这篇我觉得有点难度,我会更慢的更详细的分析一些 case . MySQL 的默认事务隔离级别和其他几个主流数据库隔离级别不同,他的事务隔离级别是 RR(REPEATABLE-READ) 其他的主流数据 ...

  6. RR和RC复合语句加锁

    mysql版本:5.7 RR复合语句: insert/update/delete+select,+号左边是影响数据的排他锁,+号右边是查询(当前读,其实相当于lock in share mode)到数 ...

  7. RC隔离 更新where条件列 没有索引的情况

    CREATE TABLE `test100` ( `sn` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增编号', `phoneNo` int(11) , `c ...

  8. 一文彻底读懂MySQL事务的四大隔离级别

    前言 之前分析一个死锁问题,发现自己对数据库隔离级别理解还不够清楚,所以趁着这几天假期,整理一下MySQL事务的四大隔离级别相关知识,希望对大家有帮助~ 事务 什么是事务? 事务,由一个有限的数据库操 ...

  9. 浅谈mysql mvcc

    以下为个人理解,如有错误,还望指正!! mysql的大多数事务型存储引擎实现的都不是简单的行级锁,基于提升并发性能的考虑,他们一般都同时实现了多版本并发控制,可以认为MVCC是行级锁的一个变种,但是它 ...

随机推荐

  1. 黑马程序猿_Java 代理机制学习总结

    -------<a href="http://www.itheima.com/"">android培训</a>.<a href=" ...

  2. 第一个 Python 程序 - Email Manager Demo

    看了一些基础的 Python 新手教程后,深深感觉到 Python 的简洁与强大,这是我的第一个 Python Demo.下面是完整代码与执行截图. 代码: # encoding: utf-8 ''' ...

  3. PHP学习路径

    php学习大致可分为三个阶段: 第一阶段:基础知识,页面布局. 学习内容:html.div+css.js. 学习目标:div+css设计. 阶段二:php核心知识和数据库交互. 学习内容:php核心知 ...

  4. android圆角View实现及不同版本这间的兼容

    在做我们自己的APP的时候,为了让APP看起来更加的好看,我们就需要将我们的自己的View做成圆角的,毕竟主流也是将很多东西做成圆角,和苹果的外观看起来差不多,看起来也还不错. 要将一个View做成圆 ...

  5. yii phpexcel <转>

    原文详情参见 这里 1.下载phpexcel,将压缩包中的classes复制到protected/extensions下并修改为PHPExcel. 2.修改YII配置文件config/main.php ...

  6. js中的同步与异步

    同步:提交后等待服务器的响应,接收服务器返回的数据后再执行下面的代码    异步:与上面相反,提交后继续执行下面的代码,而在后台继续监听,服务器响应后有程序做相应处理,异步的操作好处是不必等待服务器而 ...

  7. 把某个asp.net 控件 替换成 自定义的控件

    功能:可以把某个asp.net 控件 替换成 自定义的控件 pages 的 tagMapping 元素(ASP.NET 设置架构) 定义一个标记类型的集合,这些标记类型在编译时重新映射为其他标记类型. ...

  8. excel - 统计字符个数综合案例

    本文通过一个综合的案例来介绍excel统计字符数的一些方法和思路,供大家参考和学习. 下图是一个excel数据源截图,我们逐一讲解不同条件的统计字符数. 第一,统计A2所有的字符数,不论是汉字和数字. ...

  9. IIS 配置问题解决

    无法识别的属性“targetFramework”.请注意属性名称区分大小写. 配置错误 说明: 在处理向该请求提供服务所需的配置文件时出错.请检查下面的特定错误详细信息并适当地修改配置文件. 分析器错 ...

  10. VBoxManage 命令行使用

    原文地址:http://cnjun939.blog.163.com/blog/static/78144538201251474311135/ 由于最近需研究virtualbox,看好看到上面的网址有, ...