1.7 Transaction Management

  • A transaction is any one execution of a user program in a DBMS.
  • Concurrent Execution of Transactions
    • locking protocol is a set of rules to be followed by each transaction and enforced by DMS in order to ensure that even though actions of several transactions might be interleaved, the net effect is identical to executing all transactions in some serial order.
    • Lock is a mechanism used to control access to database objects
      • shared locks on an object can be held by two different transactions at the same time
      • exclusive lock on an object ensures that no other transactions hold any lock on this object.


  • Incomplete Transactions and System Crashes
    • The DBMS maintains a log of all writes to the database
    • Write-Ahead Log (WAL): each write action must be recorded in the log (on disk) before the corresponding change is reflected in the database itself.
    • Checkpoint: The procedure of periodically forcing some information to disk to reduce the time required to recover from a crash.
  • Summary
    • Every object that is read or written by a transaction is first locked in shared or exclusive mode, respectively. Placing a lock on an object restricts its availability to other transactions and thereby affects performance.
    • For efficient log maintenance, the DBMS must be able to selectively force a collection of pages in main memory to disk. Operating system support for this operation is not always satisfactory.
    • Periodic checkpointing can reduce the time needed to recover from a crash. Of course, this must be balanced against the fact that checkpointing too often slow down normal execution.