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.

14m read timeFrom postgr.es
Post cover image
Table of contents
The table fills up and evicts your tailWhat it never records at allIt only sees one nodeThe knobs, and what they costWho can see whatSo what is it good for, and where does it leave you?
10.2K Impressions