为表锁专题

Mysql 行级锁读锁/写锁加锁时机以及如何避免行锁升级为表锁

这里只讲innodb  RR(可重复读)级别下:                 --手动加行读锁:select * from tablename  where id =1 lock in share mode                  --手动加行写锁:select * from tablename  where id =1 for update 自动加行锁的情况,当使用updat

Mysql 行级锁读锁/写锁加锁时机以及如何避免行锁升级为表锁

这里只讲innodb  RR(可重复读)级别下:                 --手动加行读锁:select * from tablename  where id =1 lock in share mode                  --手动加行写锁:select * from tablename  where id =1 for update 自动加行锁的情况,当使用updat