PITR Best Practices
Align WAL retention with legal/compliance windows. These rules keep point-in-time recovery dependable when someone drops the wrong table.
Search across all documentation pages
Align WAL retention with legal/compliance windows. These rules keep point-in-time recovery dependable when someone drops the wrong table.
archive_mode or choosing cloud backup retention.archive_mode on primary from day one. Not after first incident.pg_stat_archiver.failed_count with alert threshold 1. Any failure widens RPO.archive_command (test ! -f or pgBackRest). Retries must succeed.archive_timeout appropriate for low-traffic DBs. Avoid stale RPO on idle systems.pg_create_restore_point before high-risk DDL. Mandatory in change tickets.recovery_target_time. UTC with offset in runbooks.recovery_target_action = pause for first attempt. Validate before promote.data_dir. Restore to scratch; swap after proof.PITR_RTO_SECONDS.pg_is_in_recovery() = false.cp archives.stanza and archive-push in same job monitoring. Unified chain.archive_mode, daily base backup, 7-day WAL retention minimum, monthly drill.
No. Standby does not replace durable archive for rewind before promotion mistakes.
Restore points are WAL labels; retention follows archive retention, not separate TTL.
Legal hold wins; export or extend archive storage beyond default PITR window.
Use recovery.signal; verify pg_verifybackup if using backup manifests. Test drills on 18.4.
Stack versions: This page was written for PostgreSQL 18.4 (stable 18, maintenance 17), pgvector 0.8+, PgBouncer 1.x, Patroni 3.x, and PostGIS 3.5+.
Reviewed by Chris St. John·Last updated Jul 18, 2026