Postgres in Production Special Series: Where Your Query Text Actually Lives (Part 3)
In part 3 of a Postgres in Production series, Ryan Booz explains where pg_stat_statements stores query text: in a file on disk rather than the in-memory hash table. He covers the file's location, its append-only growth with a 2× size ceiling, the offset-and-length pointers linking hash entries to SQL, and the rewrite cycle when the file fills. He also shows how the same query text can appear multiple times and why ORM-heavy workloads can grow the file to hundreds of megabytes.
AI-written summary, checked against the cited sources. How summaries work