mysql5.5locktables与隐式事务提交commit-成都创新互联网站建设

关于创新互联

多方位宣传企业产品与服务 突出企业形象

公司简介 公司的服务 荣誉资质 新闻动态 联系我们

mysql5.5locktables与隐式事务提交commit

结论:lock tables可以隐式提交其它会话的未提交事务

测试明细:
----session 1
MySQL> start transaction;
Query OK, 0 rows affected (0.00 sec)


mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.00 sec)


mysql> use test;
Database changed


mysql> create table t_commit(a int);
Query OK, 0 rows affected (0.04 sec)


---session 2
mysql> select count(*) from test.t_commit;
+----------+
| count(*) |
+----------+
|        0 |
+----------+
1 row in set (0.01 sec)




---session 1
mysql> insert into t_commit values(1);
Query OK, 1 row affected (0.01 sec)




---session 2
mysql> lock tables test.t_commit read local;
Query OK, 0 rows affected (0.00 sec)


mysql> select count(*) from test.t_commit;
+----------+
| count(*) |
+----------+
|        1 |
+----------+
1 row in set (0.00 sec)


网页名称:mysql5.5locktables与隐式事务提交commit
文章URL:http://kswsj.cn/article/psiedh.html

其他资讯