我有两个与账簿相关的表A和B。 这两个表同时发生了很多交易。
面临的问题是:
[28] - A insert success for source entity_id: id001
[28] - B update success for destination entity_id: id002
[28] - A insert success for destination entity_id: id002
[71] - B update success for source entity_id: id001
[28] - commit success for [28] with amount 100
在线程28提交更改到账本之前,线程71更新表B。
这是因为当一个进程正在使用表时,Postgres会锁定该表。
- 我如何使线程等待当前线程完成提交?
- 如何在Postgres中锁定记录?(以便用户可以访问表中的其他帐户)