ReliabilityPITRbackupscontinuous archiving

Point-in-time recovery

Definition

Point-in-time recovery restores a full base backup and then replays the write-ahead or binary log up to a target timestamp or transaction, recovering the data as it was at that point.

In practice

It is the answer to mistakes that replicas copy instantly: a bad migration, an accidental DELETE without a WHERE, or corrupted data from a buggy release. With base backups every day and logs archived every few minutes or continuously, you can recover to just before the mistake. PostgreSQL, MySQL and the managed cloud databases all support it.

Restores take time proportional to the data size and the amount of log to replay, so a large database may need hours. Recovery usually goes to a new instance, and someone must decide what to do with writes made after the target time. Test restores regularly and store archives in a separate account.

Example

A developer drops the orders table at 14:32:10; the team restores last night's base backup to a new instance, replays WAL until 14:32:00, and copies the table back.