Summary
The pg_stat_lock view will contain one row for each lock type, showing cluster-wide locks statistics.
(Description quoted from the official PostgreSQL documentation.)
Columns
The pg_stat_lock statistics view exposes the following columns (names, types and descriptions are taken verbatim from the PostgreSQL documentation):
locktypetext
Type of the lockable object. See pg_locks for details.waitsbigint
Number of times a lock of this type had to wait because of a conflicting lock. Only incremented when the lock was successfully acquired after waiting longer than deadlock_timeout.wait_timebigint
Total time spent waiting for locks of this type, in milliseconds. Only incremented when the lock was successfully acquired after waiting longer than deadlock_timeout.fastpath_exceededbigint
Number of times a lock of this type could not be acquired via fast path because the fast path slot limit was exceeded. Increasing max_locks_per_transaction can reduce this number.stats_resettimestamp with time zone
Time at which these statistics were last reset.
Version applicability
Present in PostgreSQL 19 (verified against each release’s documentation). This object was introduced in PostgreSQL 19.
Related & references
Reference: PostgreSQL documentation — pg_stat_lock.