mysql read committed
2015-11-09 15:38
585 查看
read commit;
Oracle采用的也是 read committed
默认是:
mysql> SELECT @@GLOBAL.tx_isolation, @@tx_isolation;
+———————–+—————–+
| @@GLOBAL.tx_isolation | @@tx_isolation |
+———————–+—————–+
| REPEATABLE-READ | REPEATABLE-READ |
+———————–+—————–+
1 row in set (0.00 sec)
set session transaction isolation level read committed;
mysql> SELECT @@GLOBAL.tx_isolation, @@tx_isolation;
+———————–+—————-+
| @@GLOBAL.tx_isolation | @@tx_isolation |
+———————–+—————-+
| REPEATABLE-READ | READ-COMMITTED |
+———————–+—————-+
1 row in set (0.00 sec)
SESSION A:
set autocommit=0;
set session transaction isolation level read committed;
SESSION B:
set autocommit=0;
set session transaction isolation level read committed;
SESSION B:
mysql> insert into t1 values(200);
Query OK, 1 row affected (0.00 sec)
mysql> select * from t1;
+——+
| id |
+——+
| 100 |
| 200 |
+——+
2 rows in set (0.00 sec)
mysql> commit;
Query OK, 0 rows affected (0.00 sec)
SESSION A:
mysql> select * from t1;
+——+
| id |
+——+
| 100 |
| 200 |
+——+
2 rows in set (0.00 sec
只要B提交,A就能看到
Oracle采用的也是 read committed
默认是:
mysql> SELECT @@GLOBAL.tx_isolation, @@tx_isolation;
+———————–+—————–+
| @@GLOBAL.tx_isolation | @@tx_isolation |
+———————–+—————–+
| REPEATABLE-READ | REPEATABLE-READ |
+———————–+—————–+
1 row in set (0.00 sec)
set session transaction isolation level read committed;
mysql> SELECT @@GLOBAL.tx_isolation, @@tx_isolation;
+———————–+—————-+
| @@GLOBAL.tx_isolation | @@tx_isolation |
+———————–+—————-+
| REPEATABLE-READ | READ-COMMITTED |
+———————–+—————-+
1 row in set (0.00 sec)
SESSION A:
set autocommit=0;
set session transaction isolation level read committed;
SESSION B:
set autocommit=0;
set session transaction isolation level read committed;
SESSION B:
mysql> insert into t1 values(200);
Query OK, 1 row affected (0.00 sec)
mysql> select * from t1;
+——+
| id |
+——+
| 100 |
| 200 |
+——+
2 rows in set (0.00 sec)
mysql> commit;
Query OK, 0 rows affected (0.00 sec)
SESSION A:
mysql> select * from t1;
+——+
| id |
+——+
| 100 |
| 200 |
+——+
2 rows in set (0.00 sec
只要B提交,A就能看到
相关文章推荐
- mysql学习笔记(6)
- mysql数据库切分
- 分布式mysql中间件(mycat)
- MySQL优化--1亿条数据效率COUNT(*)
- MySql技巧个人笔记
- mysql5.5乱码解决
- mysql查询不区分大小写问题分析和解决
- 让Mysql支持Emoji表情
- mysql ERROR 1045 (28000): Access denied for user解决方法(windows环境下)
- mysql日期相减操作
- Mysql基础入门 轻松学习Mysql命令
- mysql忘记密码找回
- mysql学习笔记(5)
- MySQL常用命令 MySQL处理数据库和表的命令
- 关于MySQL
- Ubuntu下卸载mysql5.5
- mysql命令行如何操作
- MySQL 5.6关闭DNS查询
- MySQL最基本的命令使用汇总
- mysql执行计划