What is this issue?
PostgreSQL periodically writes dirty pages to disk (checkpoints). Thecheckpoint_completion_target controls how this I/O is spread:
- 0.5 (old default): Finish writes in 50% of the checkpoint interval
- 0.9 (recommended): Spread writes across 90% of the interval
A low value causes:
- I/O spikes at checkpoint time
- Query latency jitter
- Uneven disk utilization
Why it matters
I/O Spikes
Bursty writes compete with query I/O
Latency Jitter
Query response times become unpredictable
Disk Wear
SSDs prefer steady write patterns
Wasted Capacity
I/O bandwidth not fully utilized
How PG Pilot detects it
```sql SELECT name, setting FROM pg_settings WHERE name = 'checkpoint_completion_target'; ```
How to fix it
1
Increase to 0.9
This is the recommended value:
ALTER SYSTEM SET checkpoint_completion_target = 0.9;
SELECT pg_reload_conf();
2
Monitor checkpoint behavior
Check checkpoint frequency and timing:
SELECT * FROM pg_stat_bgwriter;Watch for checkpoints_timed vs checkpoints_req.
Prevention
- Set checkpoint_completion_target = 0.9 for new installations
- Monitor I/O patterns during checkpoints
- PostgreSQL 14+ defaults to 0.9