I got some idea from the README under storage/lmgr and read some code of LockAcquireExtended , but I still have some questions now.
LWLockAcquire(&MyProc->backendLock, LW_EXCLUSIVE); if (FastPathStrongRelationLocks->count[fasthashcode] != 0) acquired = false; else acquired = FastPathGrantRelationLock(locktag->locktag_field2, lockmode); 1. In the README, it says: "A key point of this algorithm is that it must be possible to verify the absence of possibly conflicting locks without fighting over a shared LWLock or spinlock. Otherwise, this effort would simply move the contention bottleneck from one place to another." but in the code, there is LWLockAcquire in the above code. Actually I can't think out how can we proceed without a lock. 2. Why does the MyProc->backendLock work? it is MyProc not a global lock. 3. for the line, acquired = FastPathGrantRelationLock(locktag->locktag_field2, lockmode); I think it should be able to replaced with "acquired = true" (but obviously I'm wrong) . I read "FastPathGrantRelationLock" but can't understand it. Any hint will be helpful. thanks!