log_min_duration_statement
No restart — reload (superuser)tuned by pgconfiguratortime (ms); -1 off, 0 logs all
Logs any statement that runs longer than this threshold — your slow-query log.
What pgconfigurator would set
32 GB · 8 vCPU · NVMe · OLTP
Computing…
Tune for your exact server → /tunecomputed in your browser · nothing uploaded
What it does
When a statement's total duration exceeds this many milliseconds, PostgreSQL writes it (with its timing) to the server log. It's the simplest, most useful way to find slow queries in production. -1 disables it; 0 logs every statement.
How to tune it
Set a threshold that surfaces genuinely slow queries without flooding the log — often 250–1000 ms to start, then tighten. Avoid 0 (log everything) on busy systems; the logging overhead and volume can themselves hurt. For aggregated stats rather than a log, use the pg_stat_statements extension.
FAQ
- log_min_duration_statement vs pg_stat_statements?
- The log captures individual slow statements with their text and timing — great for catching specific offenders. pg_stat_statements aggregates all executions of each query shape — better for 'where does total time go'. Most teams use both.