What is the Difference Between Deferred Update and Immediate Update?

🆚 Go to Comparative Table 🆚

The main difference between deferred update and immediate update lies in when the changes are applied to the database during a transaction. Here are the key differences between the two techniques:

Deferred Update:

  • Changes are not applied immediately to the database, but are instead logged and applied after the transaction is completed.
  • Also known as the NO-UNDO/REDO technique.
  • Concepts of buffering and caching are used.
  • Recovery can be slower, as all updates need to be applied at once.
  • Used for the recovery of transaction failures due to power, memory, or OS failures.

Immediate Update:

  • Changes are applied directly to the database during the transaction.
  • Also known as the UNDO/REDO technique.
  • Concept of shadow paging is used.
  • May require frequent I/O operations, potentially slowing down the recovery process.
  • Ensures that all updates of a transaction are recorded in the database, making recovery possible.

In summary, deferred update delays the application of changes to the database until the transaction is completed, while immediate update applies changes directly to the database during the transaction. Both techniques have their advantages and disadvantages, with deferred update being more suitable for recovering from certain types of failures and immediate update providing faster recovery in some cases.

Comparative Table: Deferred Update vs Immediate Update

Here is a table comparing the differences between deferred update and immediate update:

Feature Deferred Update Immediate Update
Update Application Changes are not applied immediately to the database. Changes are applied directly to the database.
Technique Also known as NO-UNDO/REDO technique. Concept of shadow paging is used.
Log File Contains all the changes that are to be applied to the database. Contains both old and new values.
Rollback Once rollback is done, all the records of the log file are discarded, and no changes are applied. Once rollback is done, the old values are restored to the database using the records in the log file.
Recovery Requires more time for recovery in case of failures. Frequent I/O operations while the transaction is being executed.
Database Maintenance Concepts of buffering and caching are used in the deferred update method.

In a deferred update, changes are not applied immediately to the database, and the log file contains all the changes that are to be applied. In contrast, in an immediate update, changes are applied directly to the database, and the log file contains both old and new values. The choice between these two techniques depends on the specific requirements and constraints of the database system being used.