pg_stat_statements: everything it can't
This title could be clearer and more informative.Try out Clickbait Shieldfor free (5 uses left this month).
A deep dive into the limitations of PostgreSQL's pg_stat_statements extension. Covers silent entry eviction when the 5000-entry cap is hit, how to detect thrashing via pg_stat_statements_info.dealloc, the failure mode where all query texts go NULL due to file I/O errors, and what the extension never captures at all: execution plans, failed queries, parameter values, sort spills, and replica workloads. Also explains configuration traps including why track_planning is off by default (spinlock contention), how track_utility floods rankings with COMMIT/ROLLBACK, why I/O timing columns read zero without track_io_timing, and the column renames introduced in PostgreSQL 17. Concludes that pg_stat_statements is a cheap, lossy counter store useful for identifying slow query shapes, but not a full query store — it's the foundation you'd build one on.