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. C++重载解析

    重载解析(overloading resolution)的规则决定了编译器为一个函数调用选用哪个函数定义.一般过程如下: 将名称相同的函数/模板函数找到并创建候选列表 从中挑选参数数目正确,符合完全匹 ...

  2. Ubuntu12.04安装hadoop

    1.      创建hadoop用户组和用户 a.  创建hadoop用户组 sudo addgroup hadoop b.  创建hadoop用户 sudo adduser –ingroup had ...

  3. android编程中setLayoutParams方法设置

    第一篇 private LinearLayout generateHeadOfControl() { LinearLayout LayoutHead = createLayout(LinearLayo ...

  4. Etcd学习(一)安装和.NETclient測试

    Etcd是一个比較新的分布式协调框架,由CoreOS的开发团队开发,如今才仅仅到0.4.6版本号,还没公布1.0版本号 我看了一下GitHub上作者们的提交记录,如今应该还在如火如荼的开发以及改动Bu ...

  5. css中var函数

    引言: 在学习elementui的时候看到一个var.css, 其中写的全部都是以--开头的属性,上google查询不是css3新增的属性,于是决定一探究竟 :root { /* Transition ...

  6. Analyzing UI Performance with Systrace 使用systrace工具分析ui性能

    While developing your application, you should check that user interactions are buttery smooth, runni ...

  7. Android 中Webview 自适应屏幕

    随笔 - 478  文章 - 3  评论 - 113 Android 中Webview 自适应屏幕   webview中右下角的缩放按钮能不能去掉 settings.setDisplayZoomCon ...

  8. struts2与spring整合问题,访问struts2链接时,spring会负责创建Action

    每次访问一次链接,spring会创建一个对象,并将链接所带的参数注入到Action的变量中(如何做到的呐) 因为: struts2的action每次访问都重新创建一个对象,那spring的ioc是怎么 ...

  9. MySQL user表root用户误删除后恢复

    mysql user表root 用户误删除后恢复root用户 方法/步骤 1.停止mysql服务:在mysql安装目录下找到my.ini:在my.ini中找到以下片段[mysqld]:另起一行加入代码 ...

  10. 【转】iOS申请发布证书-图文详解

    摘要 发布产品到App Store所需证书,2013年5月26日测试 IOS 发布证书 distribution 打包程序 真机调试证书 本文讲述发布证书的申请,申请真机调试证书请参考:http:// ...