Deferred update
Deferred Update A deferred update is a database recovery technique that is used to improve data consistency and system performance. This technique involves...
Deferred Update A deferred update is a database recovery technique that is used to improve data consistency and system performance. This technique involves...
Deferred Update
A deferred update is a database recovery technique that is used to improve data consistency and system performance. This technique involves updating the database with the final values of updated rows only after the transaction is committed, thus deferring the update to a later point in time.
How it works:
When a row is updated, the database maintains two versions of the row: the old version and the new version.
Before committing the transaction, the database compares the old and new versions of the row.
If the old and new versions are identical, the database does not update the row.
If the old and new versions are different, the database updates the row to the new version.
The database then commits the transaction and discards the old version of the row.
Benefits of deferred updates:
Improved data consistency: Deferred updates ensure that the database is always consistent, as updates are only applied to rows that have been successfully updated.
Reduced transaction overhead: By deferring updates to a later point in time, deferred updates reduce the number of database operations, which can improve performance.
Support for distributed transactions: Deferred updates can be used in distributed database systems, where transactions are distributed across multiple nodes.
Example:
Consider a scenario where a user updates a user's name in a database. The database maintains two versions of the user's name: the old name and the new name.
Before committing the transaction, the database compares the old and new names. Since the old name and new name are identical, the database does not update the user's name.
The transaction is committed, and the new name is stored in the database.
The old name is discarded