8个级别的锁

1)8种级别锁

 2)互斥关系

转自熊灿灿的资料

3)使用示例

参考https://shiroyasha.io/understanding-postgresql-locks.html

session1:

BEGIN;ALTER TABLE users ADD age int;

session2:

SELECT locktype, relation::regclass, mode, pid FROM pg_locks WHERE pid != pg_backend_pid();

 SELECT * FROM users;

调用栈

4)逻辑

LockAcquireExtended   

     LockCheckConflicts检查是否冲突

     WaitOnLock等待锁

posted @ 2022-03-16 23:26  stupidstan2019  阅读(126)  评论(0编辑  收藏  举报