Locking

pg_locks

Also called: lock view, pg_locks system view

pg_locks is a system view exposing every lock currently held or awaited across the server: the object type, the relation, the lock mode, whether it was granted, and, importantly, a fastpath boolean showing whether the lock lives in a backend's private fast-path slots or in the shared lock table.

What this means

A system view that lists every lock currently held or waited for across the whole server, which object, which mode, and whether it's been granted yet. It even shows a fastpath flag telling you whether a lock lives in a backend's private slots or in the shared table. It's your first stop when something is blocked.

Why it matters operationally

It is the primary tool for diagnosing blocking and lock pressure. Joining it to pg_stat_activity shows who is blocking whom; the fastpath column reveals when a partition-heavy query has overflowed its fast-path slots into the contended shared table.

Related & next

The lock fast-path explainedFast-path locking, the flag you read hereDeadlock, what blocking can escalate to

Mentioned from

← All glossary terms · GUC reference · Error catalog