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.
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. |