Statistics lag causes monitoring to miss active transactions and queries
infoperformanceUpdated Feb 26, 2026
Technologies:
How to detect:
Statistics views do not update instantaneously. Each server process flushes statistics to shared memory only before going idle, but not more than once per PGSTAT_MIN_INTERVAL (1 second default). Active queries/transactions are not reflected in statistics views, causing displayed totals to lag behind actual activity.
Recommended action:
When monitoring active workloads, query pg_stat_activity for real-time current query information (always up-to-date). For cumulative statistics, account for up to 1 second lag in displayed values. Avoid making rapid successive queries to statistics views expecting updated values.