Point-in-Time Recovery (PITR)
Learning Focus
Use this lesson to understand PITR at a high level: base backups + archived WAL + a recovery target.
Concept Overview
PITR allows restoring to "just before" a failure (bad deploy, accidental delete) by:
- restoring the latest base backup
- replaying WAL from an archive up to a target time/LSN
Requirements
- regular base backups
- WAL archiving enabled (
archive_mode = on) - durable WAL archive storage
- a restore process that can fetch WAL (
restore_command)
Recovery Planning Checklist
- define RPO/RTO
- test restore in non-production
- document recovery steps and verification queries
Common Mistakes & Troubleshooting
| Mistake | What happens | Fix |
|---|---|---|
| No WAL archive | Cannot recover to a point in time | Enable WAL archiving |
| No restore tests | Unknown RTO / broken backups | Restore-test regularly |
Quick Reference
PITR = base backup + WAL archive + target time/LSN