DB Internals AtlasPostgreSQL 18.6 Home About

Parameter · Write-Ahead Log / Checkpoints

checkpoint_flush_after

Number of pages after which previously performed writes are flushed to disk. 0 disables forced writeback.

  • Default: 256kB
  • Type: integer (8kB)
  • Range: 0 … 2MB
  • Applies: Reload

In plain words

Pages written by a checkpoint first enter the operating system's cache. checkpoint_flush_after can ask the OS to begin writeback in smaller batches so less dirty data accumulates before the checkpoint's final sync. PostgreSQL 18 defaults to 256 kB on Linux and 0 on platforms where the feature is not effective.

For DBAs and operators

On Linux this uses sync_file_range() as a write-back hint, not a durability guarantee. Range 0–2 MB; 0 disables it. The setting can reduce long checkpoint-end sync stalls, but the benefit is workload- and platform-dependent.

Related knobs: bgwriter_flush_after and backend_flush_after cover other data-writing paths. On workloads where the working set benefits heavily from the OS page cache, forcing earlier writeback can add I/O, so measure checkpoint sync time and application latency before changing it.

How to change it

Change in postgresql.conf or ALTER SYSTEM, then run SELECT pg_reload_conf().

See it in context

Checkpoints Checkpointer Server shutdown modes

Related parameters

checkpoint_completion_target bgwriter_flush_after backend_flush_after wal_writer_flush_after

All Write-Ahead Log parameters