Lably
Skip to content

Transaction log

  • 3 min read
  • 2 chapters

Related on Lably

Through Database, Computer science and ACID

If, after a start, the database is found in an inconsistent state or not been shut down properly, the database management system reviews the database logs for uncommitted transactions and rolls back the changes made by these transactions. Additionally, all transactions that are already committed but whose changes were not yet materialized in the database are re-applied. Both are done to ensure atomicity and durability of transactions.

This term is not to be confused with other, human-readable logs that a database management system usually provides.

In database management systems, a journal is the record of data altered by a given process.

Anatomy of a general database log

A database log record is made up of:

  • Log Sequence Number (LSN): A unique ID for a log record. With LSNs, logs can be recovered in constant time. Most LSNs are assigned in monotonically increasing order, which is useful in recovery algorithms, like ARIES.
  • Prev LSN: A link to their last log record. This implies database logs are constructed in linked list form.
  • Transaction ID number: A reference to the database transaction generating the log record.
  • Type: Describes the type of database log record.
  • Information about the actual changes that triggered the log record to be written.

Sign in to keep reading

One more chapter is free with a Lably account.

More in Computing and communication