This topic created in 2203 days ago, the information mentioned may be changed or developed.
今天在写 sql 的时候,突然发现,在一个事务内,可以对同一个目标同时加读锁和写锁
类似于下面的 sql:
begin;
select ... lock in share mode;
select ... for update;
这个事务不会被阻塞,查看 information_schema.INNODB_TRX 表,发现 trx_rows_locked 属性值是数据行数的两倍.
不知道是不是我理解的有问题,对同一行或同一张表,可以同时加 x 锁和 s 锁吗?
1 replies • 2020-04-16 17:23:21 +08:00