Open In App

Difference between Deferred update and Immediate update

Last Updated : 05 May, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

1. Deferred Update: It is a technique for the maintenance of the transaction log files of the DBMS. It is also called NO-UNDO/REDO technique. It is used for the recovery of transaction failures that occur due to power, memory, or OS failures. Whenever any transaction is executed, the updates are not made immediately to the database. They are first recorded on the log file and then those changes are applied once the commit is done. This is called the “Re-doing” process. Once the rollback is done none of the changes are applied to the database and the changes in the log file are also discarded. If the commit is done before crashing the system, then after restarting the system the changes that have been recorded in the log file are thus applied to the database. 

2. Immediate Update: It is a technique for the maintenance of the transaction log files of the DBMS. It is also called UNDO/REDO technique. It is used for the recovery of transaction failures that occur due to power, memory, or OS failures. Whenever any transaction is executed, the updates are made directly to the database and the log file is also maintained which contains both old and new values. Once the commit is done, all the changes get stored permanently in the database, and records in the log file are thus discarded. Once rollback is done the old values get restored in the database and all the changes made to the database are also discarded. This is called the “Un-doing” process. If the commit is done before crashing the system, then after restarting the system the changes are stored permanently in the database. 

Difference between Deferred update and Immediate update:  

Deferred Update Immediate Update
In a deferred update, the changes are not applied immediately to the database. In an immediate update, the changes are applied directly to the database.
The log file contains all the changes that are to be applied to the database. The log file contains both old as well as new values.
In this method once rollback is done all the records of log file are discarded and no changes are applied to the database. In this method once rollback is done the old values are restored to the database using the records of the log file.
Concepts of buffering and caching are used in deferred update method. Concept of shadow paging is used in immediate update method.
The major disadvantage of this method is that it requires a lot of time for recovery in case of system failure. The major disadvantage of this method is that there are frequent I/O operations while the transaction is active.
In this method of recovery, firstly the changes carried out by a transaction on the data are done in the log file and then applied to the database on commit. Here, the maintained record gets discarded on rollback and thus, not applied to the database.  In this method of recovery, the database gets directly updated after the changes made by the transaction and the log file keeps the old and new values. In the case of rollback, these records are used to restore old values.
Feature Deferred Update  Immediate Update
 
Update timing  Updates occur after instruction execution  Updates occur during instruction execution
 
Processor speed  May be faster: update occurs after instruction execution, allowing for multiple updates to be performed at once  May be slower: update occurs during instruction execution, potentially causing the processor to stall
Complexity  More complex: requires additional instructions or mechanisms to handle updates after instruction execution  Less complex: updates occur immediately during instruction execution
 
Consistency May result in temporary inconsistency between data in registers and memory  Data in registers and memory are always consistent
 
Flexibility  May be more flexible: allows for more complex data manipulations and algorithms  Less flexible: immediate updates can limit the range of data manipulations and algorithms that can be performed
 

Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads