Locking

Fast-path locking

Also called: fast-path lock, fpRelId slots, weak relation lock fast path

Fast-path locking lets a backend record a weak relation lock (AccessShareLock, RowShareLock, or RowExclusiveLock, the kinds ordinary queries take, which never conflict with each other) in its own PGPROC rather than in the shared lock table. Each backend has 16 such slots, so the common case skips the partitioned lock table and its LWLocks entirely.

What this means

The locks ordinary queries take on a table (the weak, read-ish kinds that never conflict with each other) don't need the big shared lock table. Each backend records up to 16 of them in its own private slots instead, so the common case skips the shared, contended machinery entirely and stays fast.

Why it matters operationally

It removes lock-manager contention for normal queries. But there are only 16 slots: a statement locking more than 16 relations (a wide partitioned table) overflows into the slow shared table, and the arrival of a strong DDL lock forces fast-path locks to be transferred there too. Both show up as fastpath = false in pg_locks.

Related & next

The lock fast-path explainedHeavyweight lock, what fast-path avoidspg_locks, where you see the fastpath flag

← All glossary terms · GUC reference · Error catalog