📜  延迟更新和立即更新的区别

📅  最后修改于: 2021-09-09 11:49:54             🧑  作者: Mango

1. 延迟更新:
它是一种用于维护 DBMS 的事务日志文件的技术。它也称为 NO-UNDO/REDO 技术。它用于恢复由于电源、内存或操作系统故障而发生的事务故障。无论何时执行任何事务,都不会立即对数据库进行更新。它们首先记录在日志文件中,然后在提交完成后应用这些更改。这称为“重做”过程。回滚完成后,任何更改都不会应用于数据库,日志文件中的更改也将被丢弃。如果提交是在系统崩溃之前完成的,那么在系统重新启动后,已记录在日志文件中的更改将应用于数据库。

2. 即时更新:
它是一种维护DBMS 事务日志文件的技术,也称为UNDO/REDO 技术。它用于恢复由于电源、内存或操作系统故障而发生的事务故障。每当执行任何事务时,都会直接对数据库进行更新,并且还会维护包含旧值和新值的日志文件。提交完成后,所有更改都会永久存储到数据库中,因此日志文件中的记录将被丢弃。回滚完成后,旧值将在数据库中恢复,并且对数据库所做的所有更改也将被丢弃。这称为“不做”过程。如果提交是在系统崩溃之前完成的,那么在系统重新启动后,更改将永久存储在数据库中。

延迟更新和立即更新的区别:

S.NO. Deferred Update Immediate Update
1. In deferred update, the changes are not applied immediately to the database. In immediate update, the changes are applied directly to the database.
2. 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.
3. 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 into the database using the records of the log file.
4. Concepts of buffering and caching are used in deferred update method. Concept of shadow paging is used in immediate update method.
5. 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.