Parameter · Write-Ahead Log / Settings
full_page_writes
Writes full pages to WAL when first modified after a checkpoint. A page write in process during an operating system crash might be only partially written to disk. During recovery, the row changes stored in WAL are not enough to recover. This option writes pages when first modified after a checkpoint to WAL so full recovery is possible.
- Default:
on - Type: bool
- Applies: Reload
In plain words
A data page is 8 kB, but disks may write in smaller pieces. If the server loses power in the middle of writing a page, the page can end up half old and half new (a "torn page"). WAL usually only stores the small change, which cannot fix a torn page.
With full_page_writes = on, the first time a page is changed after each checkpoint the whole page is copied into WAL, so recovery can restore it completely. Turning it off saves WAL but risks unrecoverable corruption.
For DBAs and operators
After each checkpoint's redo point, the first modification of every page writes a full-page image (FPI) into the WAL record. During crash recovery the FPI overwrites whatever is on disk, so torn writes don't matter. Later changes to the same page before the next checkpoint log only the delta.
Cost
FPIs often make up most of the WAL volume right after a checkpoint (the "sawtooth" pattern of WAL generation). Ways to reduce them safely:
- Longer checkpoint_timeout / bigger max_wal_size: fewer checkpoints, fewer "first touches".
- wal_compression =
lz4orzstd: compresses the images.
SELECT wal_records, wal_fpi, pg_size_pretty(wal_bytes) FROM pg_stat_wal;pg_waldump --stats=record shows the FPI share per resource manager.
When off might be OK
Only when the storage guarantees atomic 8 kB writes (e.g. ZFS with copy-on-write, some battery-backed controllers). Even then, base backups force FPIs while running: pg_backup_start() enables them temporarily, and a backup taken on a standby is refused if WAL generated with FPW off was replayed: ERROR: WAL generated with "full_page_writes=off" was replayed since last restartpoint
Hint-bit changes are only logged as FPIs when wal_log_hints is on or data checksums are enabled (the default for new clusters since PostgreSQL 18).
How to change it
Change in postgresql.conf or ALTER SYSTEM, then run SELECT pg_reload_conf().
See it in context
Full-page writes Write-ahead log (WAL) Crash recovery Checkpoints Life of a DELETE Commit log, hint bits and subtransactions
Related parameters
wal_compression wal_log_hints checkpoint_timeout max_wal_size fsync