PostgreSQL

Frequent pg_locks queries can degrade database performance

warning
performanceUpdated Feb 26, 2026
Technologies:
How to detect:

Very frequent access to pg_locks view can impact database performance because querying it locks the regular and/or predicate lock manager while collecting lock data, even though locks are held only for the minimum time necessary.

Recommended action:

Reduce frequency of queries against pg_locks view in monitoring systems. Aggregate lock statistics at longer intervals rather than querying every few seconds. Consider caching results or using sampling approaches for lock monitoring dashboards.