Part 3 of 5 · 1 min read
Point-in-time recovery
Restoring a backup, then replaying the log forward, reaches any specific moment, not just the backup's own timestamp.
Think of restoring an old, complete photocopy of a filing cabinet. Then manually re-apply every single change recorded in a detailed changes diary, stopping that re-application at exactly the moment just before a specific mistake was made.
In plain words: point-in-time recovery restores a backup first, bringing the database to the state it held when that backup was taken, then replays the write-ahead log, covered earlier in this level, forward from that point, applying each logged change in order, up to any specific target moment chosen, rather than necessarily replaying the entire log. This is specifically useful for recovering from a human mistake, such as an accidentally run DELETE with no WHERE clause, by restoring to the exact moment just before that mistake occurred, rather than losing all the legitimate work that happened both before and after it indiscriminately.
A worked example. An accidental DELETE FROM orders; run at 2:15pm can be recovered from by restoring the most recent backup, then replaying the log forward only up to 2:14pm, recovering every legitimate change up to that point while excluding the destructive statement entirely.
The key lines. No new SQL; point-in-time recovery is performed through a dedicated recovery utility that combines a restored backup with controlled log replay up to a chosen target time.
Point-in-time recovery
Point-in-time recovery restores a backup, then replays the write-ahead log forward from that point up to a specific chosen moment, letting a database be recovered to just before a specific event rather than only to a backup's own timestamp.
Example: restoring an old photocopy, then re-applying a changes diary only up to the moment just before a specific mistake, mirrors point-in-time recovery.