beginTransaction -- 事务开始
select * A表 where id = 1 for update;
假如有其它表也要update, 不只是A表。如:
update B表 set **** where id = *;
update C表 set **** where id = *;
update A表 set *** where id = 1;
update D表 set **** where id = *;
update E表 set **** where id = *;
commit -- 提交
这时,只有A表ID1的行加了行锁,B、C、D、E 均未加锁,在高并发情况下。我想了解下,在同一事务里,我想请教的是:
1、BCDE这四表是否无须再加锁?
2、会不会是B C 两表无须加锁,但DE需要加锁?
3、如果每个表都需要加锁,是否建议采用文件锁?
还望大神购教一下,谢谢!