Does enabling pg_stat_statements reduce disk space? Recently I was informed that since enabling pg_stat_statements, the available disk space is dropping fast. I don't think it's caused by that, but I wonder: Does enabling pg_stat_statements reduce disk space? And by how much?
pg_stat_statements shouldn't use much disk space.

It uses two files:


pg_stat_statements.stat persists pg_stat_statement's data across server restarts.

It is written upon shutdown and read on server startup. The file is deleted as soon as it has been read, so it should not be present when the server is up.
pg_stat_tmp/pgss_query_texts.stat contains the text of the queries being tracked.

This file will grow as new statements are added, but if it becomes too big, pg_stat_statements will perform a &ldquo;garbage collection&rdquo; and rewrite it.


If you suspect that there is a disk space problem with pg_stat_statements, check pg_stat_tmp/pgss_query_texts.stat. But I don't think this file can be a problem unless you set pg_stat_statements.max to an astronomically high value and run lots of different statements.