Part 3 of 5 · 1 min read
Redo: reapplying committed changes
Any change whose log entry exists and whose transaction committed is reapplied, even if its data page was never flushed.
Think of returning to a construction site after an unexpected stoppage. Check the filed permits, and finish every change whose permit had already been fully approved and signed off before the stoppage happened.
In plain words: redo means reapplying a logged change to the data page, for any log entry belonging to a transaction that had already committed before the crash. Since the data page might never have been flushed before the crash, redoing ensures the committed change actually ends up reflected in the data file, exactly satisfying the durability guarantee from Level 7: once committed, a change must survive a subsequent crash. Redo is applied for every committed transaction's log entries, regardless of whether that specific page happened to already be flushed or not; redoing an already-correct page simply has no additional effect.
A worked example. A price update logged and committed before a crash, but whose data page was never flushed, is redone during recovery, writing the new price to the data file so the committed change is not lost.
The key lines. No new SQL; redo is an automatic step the database's recovery process performs when restarting after a crash, before the database becomes available again.
Redo
Redo reapplies a logged change to the data page for any transaction that had already committed before a crash, ensuring every committed change is reflected on disk even if its page was never flushed before the crash.
Example: finishing every construction change whose permit was already fully approved before an unexpected stoppage mirrors redo reapplying committed changes.