Recovery Testing and Data Integrity
Compare a restored point with independent integrity expectations and recovery objectives.
database, postgresql, recovery, backup, integrity, pitrRecovery is an exercised capability
A successful backup job, archive listing, or healthy replica is not proof of recovery. Define the recovery point objective (acceptable data loss) and recovery time objective (acceptable restoration time), protect backup access, and regularly test against those objectives in an isolated environment.
SQL illustration
Assume a fictional restore test has independently established that two
specific book IDs should exist at the selected recovery point. This query is
one check against the restored persistent training.books table:
SELECT id, title FROM training.books WHERE id IN (1, 2) ORDER BY id;
The expected result depends on the independently recorded fixture and recovery point. A matching count of two would not prove the titles, relationships, constraints, or application behaviour are correct. Verify expected values, keys, foreign keys, business invariants and relevant application flows; investigate discrepancies rather than accepting a count.
See the reasoning
Follow the example one step at a time
Follow a fictional restore test from a recovery target to application checks. This is a prepared teaching demonstration, not live code execution.
Choose the target
base backup ── WAL ── target ── mistake
↑
stop before mistakeThe base backup and continuous WAL must cover the selected target; a logical dump alone cannot replay WAL.
Recover to the right point
Physical point-in-time recovery combines a suitable base backup with the
continuous required WAL through the target. Missing WAL can prevent reaching
that point; a pg_dump logical archive cannot be used as the base for WAL
replay. Choose a target before a known mistake when appropriate, restore in an
authorised isolated cluster, and verify data and applications. Account for
external systems, credentials, encryption, roles and configuration as well as
the database. Measure actual duration and potential data loss against RTO
and RPO, record failures, and repeat the exercise.
Reflect on the concept
Four fixed questions to reinforce the reasoning. Answers are not saved or scored.
