Parameter · Write-Ahead Log / Archiving
archive_timeout
Sets the amount of time to wait before forcing a switch to the next WAL file. 0 disables the timeout.
- Default:
0 - Type: integer (s)
- Range: 0 … 1073741823s
- Applies: Reload
In plain words
The archiver only copies complete 16 MB WAL files. On a quiet server one file can take hours to fill, so the latest changes would not reach the archive for a long time. archive_timeout forces PostgreSQL to close the current file and start a new one after this many seconds, if anything was written.
For DBAs and operators
When greater than 0, the checkpointer forces a segment switch if this time has passed since the last switch and there was any WAL activity. Forced files are still full-size (16 MB, mostly empty, though they compress very well), so a very short timeout bloats the archive: with 60 s, a server that writes a little every minute archives about 23 GB/day of segments. A minute or so is a common choice; if you need near-zero data loss, use streaming replication or pg_receivewal instead.
You can also switch manually: SELECT pg_switch_wal();. 0 (default) disables the timeout.
How to change it
Change in postgresql.conf or ALTER SYSTEM, then run SELECT pg_reload_conf().
See it in context
Archiving and point-in-time recovery Archiver Write-ahead log (WAL)