Deferred Update vs Immediate Update
Deferred Update and Immediate Update are two techniques used to maintain transaction log files of Database Management Systems (DBMS). Transaction log (also referred to as the journal log or the redo log) is a physical file that stores the Transaction ID, the time stamp of the transaction, the old value and the new values of the data. This allows the DBMS to keep track of the data before and after each transaction. When the transactions are committed and the database is returned to a consistent state, the log might be truncated to remove the committed transactions.
Deferred Update
Deferred update also called NO-UNDO/REDO is a technique used to recover/support transaction failures that occur due to operating system, power, memory or machine failures. When a transaction runs, any updates or alterations made to the database by the transaction are not done immediately. They are recorded in the log file. Data changes recorded in the log file are applied to the database on commit. This process is called “Re-doing”. On rollback, any changes to data recorded in the log file are discarded; hence no changes will be applied to the database. If a transaction fails and it is not committed due to any of the reasons mentioned above, the records in the log file are discarded and the transaction is restarted. If the changes in a transaction are committed before crashing, then after the system restarts, changes recorded in the log file are applied to the database.
Immediate Update
Immediate update also called UNDO/REDO, is also another technique used to recover/support transaction failures that occur due to operating system, power, memory or machine failures. When a transaction runs, any of the updates or alterations made by the transaction are written directly in to the database. Both the original values and the new values are also recorded in the log file before changes are made to the database. On commit all changes made to the database are made permanent and the records in the log file are discarded. On rollback old values are restored in to the database using the old values stored in the log file. All the changes made by transactions to the database are discarded and this process is called “Un-doing”. When the system restarts after a crash, all the database changes are made permanent for committed transactions. For uncommitted transactions, original values are restored using the values in the log file.
What is the difference between Deferred Update and Immediate Update
Even though Deferred Update and Immediate Update are two methods for recovering after a system failure, the process that each method uses is different. In differed update method, any changes made to the data by a transaction are first recorded in a log file and applied to the database on commit. In immediate update method, changes made by a transaction are directly applied to the database and old values and new values are recorded in the log file. These records are used to restore old values on rollback. In differed update method, records in the log file are discarded on roll back and are never applied to the database. One disadvantage of deferred update method is the increased time taken to recover in case of a system failure. On the other hand, frequent I/O operations while the transaction is active, is a disadvantage in immediate update method.
Jeleigh15 says
very informative article :))
Sahil Sharma says
Concise and GREAT
Jessica says
Please what is the Disadvantage and advantage of deferred update