• ADADADADAD

    锁表特点--myisam和innodb的不同之处[ mysql数据库 ]

    mysql数据库 时间:2024-12-03 12:11:20

    作者:文/会员上传

    简介:

    对于myisam表, lock table table_name read local, 并且下面参数为2, 3 ,那么允许另一个回话执行insert 语句
    root@sakila 08:17:02>show variables like '%concurrent%';
    +--

    以下为本文的正文内容,内容仅供参考!本站为公益性网站,复制本文以及下载DOC文档全部免费。

    对于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的不同之处.docx

    将本文的Word文档下载到电脑

    推荐度:

    下载
    热门标签: myisaminnodb不同