锁表特点--myisam和innodb的不同之处
对于myisam表, lock table table_name read local, 并且下面参数为2, 3 ,那么允许另一个回话执行insert 语句
root@sakila 08:17:02>show variables like '%concurrent%';
+-------------------+--------+
| Variable_name | Value |
+-------------------+--------+
| concurrent_insert | ALWAYS |
+-------------------+--------+
1 row in set (0.01 sec)
root@sakila 08:19:29>lock table myfilm_text read local;
Query OK, 0 rows affected (0.01 sec)
同一个会话是不能执行insert的,因为你上的是只读锁
root@sakila 08:19:37>insert into myfilm_text(film_id, title) values(1002, 'Test');
ERROR 1099 (HY000): Table 'myfilm_text' was locked with a READ lock and can't be updated
*********************************************
另一个会话:
可以并发插入,依次可以实现一定程度的并发。
root@sakila 08:18:32>insert into myfilm_text(film_id, title) values(1002, 'Test');
Query OK, 1 row affected (0.02 sec)
本文名称:锁表特点--myisam和innodb的不同之处
网站URL:http://scyanting.com/article/ghepip.html
root@sakila 08:17:02>show variables like '%concurrent%';
+-------------------+--------+
| Variable_name | Value |
+-------------------+--------+
| concurrent_insert | ALWAYS |
+-------------------+--------+
1 row in set (0.01 sec)
root@sakila 08:19:29>lock table myfilm_text read local;
Query OK, 0 rows affected (0.01 sec)
同一个会话是不能执行insert的,因为你上的是只读锁
root@sakila 08:19:37>insert into myfilm_text(film_id, title) values(1002, 'Test');
ERROR 1099 (HY000): Table 'myfilm_text' was locked with a READ lock and can't be updated
另一个会话:
可以并发插入,依次可以实现一定程度的并发。
root@sakila 08:18:32>insert into myfilm_text(film_id, title) values(1002, 'Test');
Query OK, 1 row affected (0.02 sec)
本文名称:锁表特点--myisam和innodb的不同之处
网站URL:http://scyanting.com/article/ghepip.html