PostgreSQL 19 adds pg_stat_lock for lock contention monitoring
PostgreSQL 19 introduces the pg_stat_lock view with cumulative lock statistics: wait counts, total wait time and fast-path slot overflow. Only waits longer than deadlock_timeout that end in a successful lock acquisition are counted.
- pg_stat_lock returns 12 rows, one per lock type
- Only waits longer than deadlock_timeout ending in success are counted
- fastpath_exceeded tracks exhaustion of fast-path slots
- Statistics reset via pg_stat_reset_shared('lock')
Read next
Software