DBRaven

Summary

Write-heavy transactional workloads trigger frequent PostgreSQL checkpoints that flush large numbers of dirty pages to disk simultaneously, causing I/O spikes that interrupt query execution and increase write amplification beyond the WAL baseline.

Evidence

  • ·PostgreSQL checkpoints flush all dirty shared_buffers pages to disk: at high write rate, this can be 1-10GB in 5 minutes
  • ·Checkpoint I/O is spread over checkpoint_completion_target (default 0.9) fraction of the interval: but still spikes
  • ·pg_stat_bgwriter.checkpoints_timed vs checkpoints_req: high checkpoints_req indicates checkpoints are too frequent
  • ·Full page writes (FPW) during checkpoint double the WAL write cost for modified pages in the next checkpoint interval
  • ·A poorly tuned checkpoint interval at 5K writes/second can produce 500-1000ms I/O spikes every 5 minutes

Operational Context

  • ·Increase max_wal_size (default 1GB) to allow longer checkpoint intervals: reduces checkpoint frequency at the cost of recovery time
  • ·Set checkpoint_completion_target=0.9 (default) to spread checkpoint writes over 90% of the interval
  • ·Monitor pg_stat_bgwriter.buffers_checkpoint: high values relative to buffers_alloc indicate checkpoint I/O dominance

Tradeoffs

  • ·Larger max_wal_size means longer crash recovery time: trade checkpoint frequency for recovery time
  • ·Disabling full page writes (off recommended only with storage-level checksum) reduces WAL size but risks corruption
  • ·Checkpoint amplification is inherent to PostgreSQL's MVCC architecture: cannot be fully eliminated

Evidence grounding

Grounded, 5 supporting items

Checkpoint I/O amplification is a documented PostgreSQL scaling challenge for write-heavy workloads, covered in PostgreSQL tuning guides and post-mortems from Heroku, Citus, and EnterpriseDB.