How to get an estimate of the impact of writing Postgres logs with log_min_duration_statement = 0
:
-
Do
select pg_stat_statements_reset();
and wait N seconds (where N >> 60 – say 1-24 hours, covering typical busy hours). Remember when it was, and write down somewhere – this timestamp will be needed! -
Check if
select count(*) from pg_stat_statements
is lower thanpg_stat_statements.max
. If it's equal to it, then raisepg_stat_statements.max
and restart with the step 1. -
Get the estimate:
\set TS_PGSS_RESET 'XXXX-XX-XX XX:XX:XX';