Checkpoint Pressure

Checkpoint counters matter when sampled as deltas and joined to foreground latency.

Database · SQL

PostgreSQL Checkpoint Pressure

Checkpoint tuning is an I/O budget shared with foreground transactions and recovery.

SELECT now() AS sampled_at,
       num_timed, num_requested,
       write_time, sync_time, buffers_written
FROM pg_stat_checkpointer;

-- Store samples and alert on deltas, not lifetime totals:
-- requested/timed ratio -> WAL pressure
-- sync_time/checkpoints  -> durability-path latency
-- correlate with WAL bytes, disk latency, p99, and replica lag.

Invariant: Checkpoint rate and duration remain inside the tested foreground-latency and disk-headroom budget.

Use when: You need to distinguish WAL pressure from a slow durability path.

Why this boundary matters

Requested checkpoints and long sync phases can turn durability work into tail latency. Counter deltas distinguish WAL pressure from storage latency.

Failure policy

BoundaryAction
Requested checkpoints risingInspect WAL rate before changing capacity
Write time highCorrelate dirty-page volume with storage throughput
Sync time highInvestigate durability-path latency
Archiving or slot stalledProtect disk headroom before tuning cadence
Bulk operation plannedRate-limit it against an I/O budget

Trade-offs

Larger WAL budgets reduce checkpoint frequency but reserve more disk and can extend crash recovery. Pacing cannot compensate for an unstable storage path.

Decision rule: Change checkpoint controls only from measured WAL rate, storage latency, disk headroom, and a tested recovery objective.

Further reference

Browse all engineering snippets

>