PostgreSQL · Recovery architecture
PostgreSQL recovery: connect the base backup to the WAL chain
Map the dependencies between a physical base backup, continuous WAL retention and the recovery point you need to reach.
A PostgreSQL physical backup is one part of a recovery path. To reach a later point in time, the recovery system also needs the required write-ahead log, or WAL, without a gap. Design retention around that dependency.
The short version
What to take away
- Point-in-time recovery depends on a usable base backup and continuous required WAL.
- WAL captured during a base backup does not provide every later recovery point.
- Integrity verification supports, but cannot replace, an isolated recovery test.
Define what the base backup contains
A full pg_basebackup copies the database cluster, rather than selected tables. Its WAL streaming mode collects WAL while the backup runs, supplying the records needed to make that backup usable. Capturing this bounded interval does not provide every record generated after the backup finishes.
If using incremental backups, preserve their dependencies: they must be combined with the required earlier backups before recovery. Inventory the backup format and tool options instead of assuming every directory is independently restorable. pg_basebackup.
Preserve an unbroken recovery path
For continuous-archive recovery, required WAL must extend back to the backup's start and continue through the chosen target. The target must be after that base backup finished; an earlier target requires an earlier backup. A logical pg_dump cannot replace the physical base backup in this chain.
In the diagram's hypothetical broken path, WAL 1 is available, the next required segment is missing, and WAL 3 contains later work. WAL 3 cannot bridge the required gap. A recent archive file therefore does not demonstrate continuity from the selected backup.
Review backup retention and WAL retention together. Keep the dependencies needed by every recovery point you intend to support. Configuration-file changes are another dependency: WAL replay does not restore edits to files such as postgresql.conf or pg_hba.conf. Protect those separately. Continuous archiving and PITR.
Make the recovery target explicit
Record the intended target, its time zone where applicable, the timeline and the desired action on reaching it. PostgreSQL supports recovery targets and can pause, shut down or promote when the target is reached. A recovery test should verify the selected behavior before normal application access is allowed. Recovery target settings.
Use pg_verifybackup to check a supported backup against its manifest. It cannot perform every check a running server performs during recovery, so a successful result still needs an isolated recovery exercise. Keep a record of which backup, archive and target were actually tested. pg_verifybackup.
Sources and next step
This architecture uses PostgreSQL 18 behavior. Match procedures and tooling to the source server and recovery environment.