1. Gyanastra
  2. Database Systems
  3. Recovery Policies: Steal-Force, Deferred and Immediate Update, Shadow Paging and ARIES
  4. Deferred vs Immediate database modification
Free lesson, no account needed 4 min read
Asked in past papers1 time
  • UGC NET2006

Database Systems · Recovery Policies: Steal-Force, Deferred and Immediate Update, Shadow Paging and ARIES

Deferred vs Immediate database modification

These are the two classic textbook protocols (Silberschatz / Korth / Elmasri-Navathe) for when a modified page is written to disk relative to commit.

2.1 Deferred database modification (No-Undo / Redo)

Rule: A transaction's updates are not written to the database until the transaction commits. Updates are kept in a local workspace / log. At commit, the updates are applied to the database.

  • Log records written: <T_i, START>, then <T_i, X, new_value> for each write, then <T_i, COMMIT>.
  • Write-ahead logging (WAL) rule: the log record for a change must reach stable storage before the corresponding data page is written. In deferred mode, data pages are written only at commit, so the log record is naturally written first.
  • Commit rule: the <COMMIT> log record must be on stable storage before the transaction is declared committed (durability). In deferred mode, the data pages are then written.
  • Recovery: only REDO is needed. If a transaction committed, redo its updates (they may not have reached disk). If it did not commit, its updates were never written, so nothing to undo.
  • Why no undo: uncommitted updates never touch the database.

2.2 Immediate database modification (Undo / Redo)

Rule: A transaction's updates may be written to the database at any time, even before commit (this is the steal policy). Therefore the log must contain enough information to undo.

  • Log records written: <T_i, START>, then <T_i, X, old_value, new_value> for each write (both old and new values are needed), then <T_i, COMMIT>.
  • WAL rule: the log record <T_i, X, old, new> must be on stable storage before the data page containing XX is written. This is the crucial rule — it guarantees that if the page reaches disk, the log can undo it.
  • Commit rule: the <COMMIT> record must be on stable storage before commit is acknowledged.
  • Recovery: both UNDO and REDO are needed. Uncommitted transactions must be undone (their changes may be on disk); committed transactions must be redone (their changes may not be on disk).

2.3 Comparison table

FeatureDeferred modificationImmediate modification
When data pages writtenonly at commitany time (steal)
Log record contentnew value onlyold value and new value
UNDO needed?NoYes
REDO needed?YesYes
Buffer policy impliedNo-Steal (effectively)Steal
WAL rulelog before data (trivially satisfied)log before data (essential)
Commit ruleCOMMIT record on disk before ack

Trap. Deferred modification is sometimes called "no-undo/redo" — meaning no undo, redo only. Do not read it as "no undo and no redo". Immediate modification is "undo/redo".


Pages 1–2 of 2