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 不支持事务

只支持表锁

优点:速度快

原文地址:https://www.cnblogs.com/wt7018/p/11610617.html