mysql 锁

引擎

1、innodb 支持事务

- 行锁
- 表锁
- 示例:
    - 终端:
        begin;    # 开启
        select xx from xx for update;
        commit;    # 终止
    - pymysql
        cursor.execute('select * from xx for update')
    - django
        with trancation.automic():
            models.User.objects.all().for_update()

2、mysiam 不支持事务

只支持表锁

优点:速度快

posted @ 2019-09-30 00:07  市丸银  阅读(134)  评论(0编辑  收藏  举报