PostgreSQL Backup & Recovery
Learn how PostgreSQL PITR works with base backups and WAL archiving, when to use it, and how to test restores against real RPO/RTO targets.
Recovery of a cluster to an exact point in time or LSN using a base backup plus archived WAL and a recovery target.
PostgreSQL writes every committed change to WAL (Write-Ahead Log). A base backup captures the database state at one point in time, and WAL archives record all subsequent changes.
During recovery, PostgreSQL restores the base backup first, then replays WAL entries until it reaches your recovery target. This model underpins serious disaster recovery strategies.
PITR is critical for production systems where restoring to the latest backup is not enough. If a bad migration or accidental delete happened at 14:03, you need the option to recover to 14:02:59.
It is commonly used for incident response, compliance workflows, and recovery from operator mistakes. Teams implementing branch-based workflows often pair PITR with database branching to reduce blast radius.
PITR and snapshots solve related but different problems. Snapshot restore is often faster for full-environment rollback. PITR is more precise when you need to recover to a specific second before corruption.
Mature teams usually use both: snapshots for broad rollback operations and PITR for timeline precision.
Run scheduled restore drills in isolated environments and measure both data correctness and time to service readiness.
If measured recovery time exceeds your RTO target, adjust storage, backup cadence, or orchestration immediately.