Skip to content

Pick a Restore Point

Run the Pick a Restore Point MicroSim Fullscreen

About This MicroSim

When a table is emptied by mistake, the question is where to restore to. Too late, and the copy already has the damage in it. Too early, and you throw away good scans, sign-ups and payments made since.

With daily backups alone, the only choice is last night's copy. With point-in-time recovery you can pick any minute, so you can stop one minute before the mistake. The incidents here are an illustrative scenario, and the rate of 40 good writes per hour is synthetic.

Learning objective (Evaluate: judge): Judge, for three data-loss incidents, which restore point recovers the most good data while excluding the damage, given daily backups alone or daily backups with point-in-time recovery.

How to Use

  1. Choose a recovery mode: Daily backup only or Point-in-time recovery.
  2. Choose an incident. The red line marks when it happened.
  3. In point-in-time mode, drag the blue marker or use the slider. Arrow keys move it one minute. The count of good writes lost updates as you move.
  4. Press Restore. You get one attempt per incident in each mode. After it, the best point shows as a green dashed line.
  5. Switch modes and compare. Mastery is all three incidents right in at least one mode.

Iframe Embed Code

You can add this MicroSim to any web page by adding this to your HTML:

<iframe src="https://arunbatchu.github.io/good-enough-engineering/sims/pick-a-restore-point/main.html"
        height="474px"
        width="100%"
        scrolling="no"></iframe>

Lesson Plan

Grade Level

Adult professional (Good Enough Engineering)

Duration

10-15 minutes

Prerequisites

Backup, restore test, point-in-time recovery and destructive migration, from the chapter sections before the sim.

Activities

  1. Exploration (5 min): Restore all three incidents with daily backups only and note the writes lost.
  2. Guided Practice (5 min): Switch to point-in-time recovery and repeat. Try a point after the incident once, to see why it's wrong.
  3. Assessment (5 min): Reach mastery. Then find out how often your own database is backed up and whether point-in-time recovery is on.

Common Misconceptions

  • Restoring the latest backup is always right.
  • A backup from after the incident is fine as long as it's recent.
  • Point-in-time recovery means nothing is lost.

Assessment

  • Picks the latest point strictly before each incident in at least one recovery mode.
  • States the good writes lost for each incident under daily backups.
  • Explains why a restore point at or after the incident brings the damage back.

References

  1. PostgreSQL documentation: Continuous archiving and point-in-time recovery - the full backup plus replayed change log behind PITR.
  2. PostgreSQL documentation: Backup and restore - the three approaches to backing up a Postgres database.