What is this issue?
The log_min_duration_statement setting logs queries that run longer than
the specified threshold:
- -1: Disabled (no duration logging)
- 0: Log ALL queries with duration
- 100: Log queries taking > 100ms
- 1000: Log queries taking > 1 second
With the value set to 0:
- Every query is logged with its execution time
- Similar impact to log_statement = all
- Creates gigabytes of logs per hour on busy systems
Why it matters
Log Volume
Millions of log entries per hour on busy systems
I/O Overhead
Significant disk I/O for logging
Disk Space
Logs can fill disk rapidly
Useful Data Buried
Slow queries hidden among fast ones
How PG Pilot detects it
```sql SELECT name, setting, unit FROM pg_settings WHERE name = 'log_min_duration_statement'; ```
How to fix it
Set a reasonable threshold
Log queries slower than 100-1000ms:
ALTER SYSTEM SET log_min_duration_statement = '100ms';
SELECT pg_reload_conf();Choose your threshold wisely
Guidelines:
- 100ms: Aggressive, catches most slow queries
- 500ms: Moderate, good for OLTP workloads
- 1000ms: Conservative, only obvious problems
- 5000ms: Minimal logging, only severe issues
Disable if using alternatives
If you use pg_stat_statements for analysis:
ALTER SYSTEM SET log_min_duration_statement = '-1';
SELECT pg_reload_conf();Prevention
- Set threshold based on workload expectations
- Use pg_stat_statements for comprehensive analysis
- Monitor log growth rates
- Adjust threshold based on observed patterns