关闭

REPEATABLE-READ 预读

115人阅读 评论(0) 收藏 举报
分类:
<pre name="code" class="sql">SELECT @@GLOBAL.tx_isolation, @@tx_isolation; 

SESSION A:                                                SESSION B:
set autocommit=0;                                          set autocommit=0;
start transaction;    
mysql> select * from t100;
+-----+-------+
| id  | value |
+-----+-------+
|   1 | a     |
| 100 | a     |
| 200 | a     |
| 300 | a     |
| 400 | a     |
| 500 | a     |
| 600 | a     |
+-----+-------+                                          
                                                       insert into t100 values(700,'a');

mysql> select * from t100;
+-----+-------+
| id  | value |
+-----+-------+
|   1 | a     |
| 100 | a     |
| 200 | a     |
| 300 | a     |
| 400 | a     |
| 500 | a     |
| 600 | a     |
+-----+-------+
7 rows in set (0.00 sec) 
                                                             commit;


mysql>  select * from t100;
+-----+-------+
| id  | value |
+-----+-------+
|   1 | a     |
| 100 | a     |
| 200 | a     |
| 300 | a     |
| 400 | a     |
| 500 | a     |
| 600 | a     |
+-----+-------+
7 rows in set (0.00 sec)

此时SESSION A看不到SESSION B的插入:




   
0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:1386235次
    • 积分:41607
    • 等级:
    • 排名:第92名
    • 原创:2896篇
    • 转载:14篇
    • 译文:0篇
    • 评论:54条
    文章分类
    最新评论