Database Management System

⌘K
  1. Home
  2. Docs
  3. Database Management Syste...
  4. Transaction Processing, C...
  5. Recovery Technique Based on Immediate Update

Recovery Technique Based on Immediate Update

The Immediate Update recovery technique is a method used in database management systems (DBMS) to ensure that changes made by transactions are immediately written to the database.

  • This technique contrasts with Deferred Update, where updates are only written to the database when the transaction commits.
  • In Immediate Update, changes are written to the database as soon as they occur, but the system needs to handle recovery in case of failures.

How Immediate Update Works:

  • Transaction Starts: When a transaction starts, all updates (such as inserts, deletes, or modifications) are immediately written to the database. These changes are made to the actual database, not to temporary storage or log files.
  • Transaction Execution: As the transaction executes, the changes made to the data are immediately reflected in the database. However, a log file is maintained to record the operations performed during the transaction (such as the old value, new value, and the type of operation).
  • Transaction Commit: When the transaction is ready to commit:
    • A commit record is added to the log to mark the successful completion of the transaction.
    • The changes that were already written to the database during the transaction are considered permanent.
  • Transaction Abort or System Crash Before Commit:
    • If a system failure or crash occurs before the transaction commits, the updates that were already written to the database are not guaranteed to be consistent.
    • A rollback mechanism is required to undo the changes made by uncommitted transactions to maintain the database’s consistency.
    • This rollback process involves examining the transaction log to identify the changes that need to be undone, and then the database is restored to its state before the transaction started.
  • Recovery: If a failure occurs and the transaction has not committed, the system will use the transaction log to identify the uncommitted operations and undo them. The log records each change with the before image (the original data before the update) and after image (the updated data after the change). This allows the system to restore the original state by applying the before image during recovery.

How can we help?

Leave a Reply

Your email address will not be published. Required fields are marked *