028-86922220

建站动态

根据您的个性需求进行定制 先人一步 抢占小程序红利时代

锁表特点--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的不同之处
网页地址:http://www.tsicrk.com/article/ghepip.html

其他资讯

让你的专属顾问为你服务

3.1532s