DBMS-TRANSACTION MANAGEMENT

INTRODUCTION

A transaction is a collection of logical operations which occurs in a database.It is executed as a single unit.
Generally, the operations performed by any transaction are:
  • Read Operation: Reading values from the database.
  • Write Operation: Writing values to the database. 
A transaction in DBMS is analogous to a process in Operating System.

The Transaction Management is an important part of DBMS. It ensures data integrity and consistency. That is, if the database was in consistent state before a transaction, then after execution of the transaction also, the database must be in a consistent state.

ACID PROPERTIES OF TRANSACTION

ACID (Atomicity, Consistency, Isolation, Durability) is a set of properties that guarantee that database transactions are processed reliably.
  • Atomicity: It ensures that each transaction must follow "all or nothing". It means that each transaction must completes either all of its operations or nothing.
  • Consistency: It ensures that the database must remain in consistent even after any transaction.
  • Isolation: If multiple transactions are executed concurrently at the same time, the results must be same as if they were  executed serially(i.e one after the other).
  • Durability: It ensures that once a transaction has been completed successfully, the changes it has made never be lost even in case of any failure.

STATES OF TRANSACTION

A transaction must be in one of the following states:
  • Active: It is the initial state in which the transaction is executing.
  • Partially committed: It is the state after the final statement has been executed.
  • Failed: The transaction is said to be failed when the normal execution can no longer proceed.
  • Aborted: When the transaction is failed then after the transaction is rolled back and the database is restored to its state prior to the start of the transaction. The transaction in this state is said to be aborted.
  • Committed: It is the state after the successful completion of the transaction.
  • Terminated: It is the state in which the transaction finally reaches, whether it is committed or aborted.