AI Glossary / Data engineering and architecture / Intermediate
Point-in-time recovery
Definition
Point-in-time recovery, or PITR, restores a database to a recoverable state associated with a selected earlier point. It commonly combines a suitable base backup with recorded database changes, replaying those changes only as far as the chosen recovery target.
What it means
An ordinary backup captures a recoverable starting state. If useful changes occurred after it, restoring that backup alone may lose those changes. PITR uses additional history to move forward from a backup while stopping before an unwanted event.
The target must lie within the available, valid recovery history. A clock time typed into a console cannot recreate missing logs or a period outside retention. The database's transaction and target-selection semantics also determine which committed changes are included.
PITR is not a selective undo button for one mistaken action. Restoring an earlier overall state can also exclude legitimate later work. Recovering that work or reconciling other systems is a separate part of restoring the service.
How it works
A recovery process obtains the required backup and the continuous change history needed to reach the target. It restores the starting data and replays the relevant records, stopping according to the engine's configured target rules.
PostgreSQL provides a concrete example using physical base backups and archived write-ahead log records. Its ordinary logical dumps are not substitutes for a physical base backup in that WAL-replay method. Other database services manage backup and replay details differently.
The restored database is then checked before application use. Some services restore to a new instance, allowing the source to remain intact while the result is examined. Connectivity, configuration and dependent applications still need attention.
A successful restore test verifies both technical recovery and the expected business state. Merely seeing a database start does not establish that the chosen target excludes the damaging operation or includes the records the organization needs.
Three practical examples
- A team restores to a point before an accidental bulk update so it can inspect the correct earlier values.
- A service operator reconstructs a database state from within its retained recovery window after discovering a damaging deployment.
- A development team creates an isolated historical recovery copy to investigate when a data problem appeared, without immediately replacing the live service.
Think of it this way
Think of rebuilding a ledger from a saved copy and an ordered journal of subsequent changes. You can replay the journal up to an appropriate boundary instead of accepting every later entry.
The analogy does not imply that database logs are readable business ledgers or that any individual operation can be omitted safely. Database recovery follows engine rules, and external actions such as sent messages are not reversed by reconstructing stored records.
Worked example
Choosing what the recovered state includes
In an invented sequence, a valid backup is available from 09:00. Transaction A commits at 09:20, transaction B commits at 09:40, an erroneous bulk update commits at 10:00, and legitimate transaction C commits at 10:05.
Assume the required logs are intact and the chosen target is just before the erroneous commit. Recovery includes A and B but excludes both the erroneous update and C. It does not automatically preserve C merely because C was legitimate.
The team must therefore decide how to recover or reconcile C using trustworthy evidence. The example deliberately uses a clear transaction boundary; real target selection requires checking the engine's time interpretation, inclusion rules and available transaction evidence. “Before the mistake” must become a specific, tested recovery target.
Illustrative case study
A fictional subscription-learning service discovers a faulty update to course-access records. The team restores a separate database copy to an earlier point and confirms that the affected records are correct there.
It then notices that legitimate enrollments and confirmation messages occurred after that point. Redirecting the application immediately would make those enrollments disappear from the database even though learners received confirmations.
The team preserves evidence of later activity and prepares a reconciliation plan before switching the service. The lesson is that database recovery and business recovery overlap but are not identical. A technically valid earlier state can still conflict with events outside the database.
Common misconceptions and mistakes
- PITR can recover any date ever recorded. Recovery is bounded by retained backups, required logs and the system's capabilities.
- A replica automatically protects against an accidental update. Replication can copy the same unwanted change; historical recovery serves a different purpose.
- Recovering to before a mistake keeps all later good work. Later work is outside that recovered state unless separately reconstructed or reconciled.
Business use
PITR supports continuity when current database contents cannot be trusted, but it needs preparation. Define how much history must remain recoverable and how long restoring a useful service may take. These are different questions: a recent recovery target does not imply an instant recovery process.
Exercise restoration on an isolated target and verify representative records, permissions and application behavior. Monitor the backup and log chain, since an unnoticed gap can invalidate a recovery plan precisely when it is needed.
For AI-enabled services, consider derived search indexes, caches and external workflow actions. A restored source database may no longer match those components. Rebuilding or reconciling them can be necessary before answers and actions reflect the recovered state consistently.
People also ask
Is PITR the same as restoring the latest backup?
No. It can use change history to reach a selected target beyond an earlier backup, subject to available coverage.
Can recovery be performed without overwriting the source?
Some systems restore to a separate instance or environment; the supported procedure must be checked.
Does PITR undo emails or external transactions?
No. Restoring database state does not reverse actions already completed elsewhere.
Check your understanding
Why is legitimate transaction C missing from the recovered state in the example?
Answer: C committed after the selected recovery target. PITR reconstructs the state at that target rather than classifying later transactions as good or bad and selectively retaining them.
Related terms
- Backup
- Replication (statistics)
- write-ahead log
- transaction
- recovery target
- recovery point objective
- recovery time objective
- replication
- data reconciliation
Learn next
Read backup chains and transactions. Build a disposable sequence containing known good and bad changes, recover to a specified boundary and verify exactly which committed records are present.
More in Data engineering and architecture
- Physical Independence - Physical independence, usually called physical data independence in databases, is the ability to change physical storage or access arrangements without...
- Physical schema - A physical schema describes how a database's data structures are implemented for a particular database system.
- Pilot job - A pilot job is a job that acquires computing resources so an application-level system can subsequently schedule tasks within that allocation.
- Pointer-based model - A pointer-based model represents relationships through references that lead from one data object or record to another.
- Pointer jumping - Pointer jumping is a parallel algorithmic technique that repeatedly replaces a link with a link farther along the same chain, often the current successor's...
- Polyglot persistence - Polyglot persistence is the use of different data-storage technologies within an application or organization to suit different data and access needs.
Sources
PostgreSQL documentation, Continuous Archiving and Point-in-Time Recovery: https://www.postgresql.org/docs/18/continuous-archiving.html. Primary description of base backups, WAL coverage and recovery.
Amazon RDS User Guide, Restoring a DB instance to a specified time: https://docs.aws.amazon.com/us_en/AmazonRDS/latest/UserGuide/USER_PIT.html. Primary example of retention boundaries and restoring to a new instance.
PostgreSQL documentation, Timelines: https://www.postgresql.org/docs/16/continuous-archiving.html. Primary discussion of recovery histories. The transaction sequence and learning-service case are original illustrations.
Previous: Point-in-Time Correct Joins Next: Point (range) operation