Transaction in Database

A transaction can be defined as a unit or part of any program at the time of its execution. During transactions  data  items  can  be  read  or  updated or  both.

1. ACID Properties of Transaction

The database system is required to maintain the following properties of transactions to ensure the integrity of the data.

  1. Atomicity : A transaction must be Atomic transaction means either all operations within a  transaction  are  completed  or  none.
  2. Consistency : A transaction must be executed in It means variables used by a transaction cannot be changed by any other transaction concurrently.
  3. Isolation : During concurrent transaction each transaction must be unaware of other For any transaction Ti, it appears toTi that any other transaction Tk is either finished before starting  of Ti or  started after Ti finished.
  4. Durability : Changes are made permanent to database after successful completion of transaction even  in  the  case  of  system  failure or crash.

2. Transaction States

A transaction  must  be in  one  of  the following  states  as shown  in  Figure  8.1.

  1. Active state : It is the initial state of During execution of statements, a transaction is in active state.
  2. Partially committed : A transaction is in partially committed state, when all the statements within transaction  are executed but  transaction  is not committed.
  3. Failed : In any case, if transaction cannot be proceeded further then transaction is in failed state.
  4. Committed : After successful completion of transaction, it is in committed state.

Source: Gupta Satinder Bal, Mittal Aditya (2017), Introduction to Basic Database Management System, 2nd Edition-University Science Press (2017)

Leave a Reply

Your email address will not be published. Required fields are marked *