Transaction in Database Management System

In this article, we are going to discuss about the introduction of transaction and properties of transaction and transaction states in Database management system.
Submitted by Prerana Jain, on June 16, 2018


A transaction is a logical unit of database processing that includes one or more database access operations such as an insertion, deletion, modification, and retrieval. Instructions are always atomic in nature i.e. either an instruction execute completely or it does not execute at all.

But it is possible to have partially executed programs which means some instructions are executed but some are not. According to the user either a work is done or not done therefore a transaction is that of instructions which perform a logical unit of work.


Transaction T transfer 100 units of account A to B.

    A= A – 100

Read(B) → If transaction fails here, then system will be inconsistent as 100 units debited from Account A but not added to account B.

    B = B + 100

To remove this partially executed problem, we increase the level of atomicity and bundle all instruction of a logical operation into a unit called transaction.

Transaction access data using two operations:

1) Read(X): It transfers the data item X from the database to a local buffer belonging to the transaction that executed the read operation.

2) Write(X): It transfers the data item X from the local buffer of the transaction that executed the write back to the database.

If we want that our database should be consistent than we understand that transaction which operates on a database must be satisfied "acid property".

Properties of Transaction

These are the important properties of transaction that a DBMS must ensure to maintain the database. These properties are called "ACID property".

  1. Atomicity
    "A" stands for atomicity it states that either all the instructions participating in a transaction will execute or none. Atomicity is guaranteed by transaction management component.
  2. Consistency
    "C" stands for consistency it states that if a database is consistent before the execution of a transaction that if must remains consistent after execution of a transaction.
    Note: If atomicity, isolation, durability holds well then consistency holds well automatically.
  3. Isolation
    Isolation means if a transaction run isolately or concurrently with other transaction then the result must be same. Concurrency control component takes cares of isolation.
  4. Durability
    Durability means that the work done by a successful transaction must remain in the system. Even in case of any hardware or software failure.
    Note: Recovery management component takes care of durability.

Recovery from failures means that the database is restored to the most consistent state just before the time of failure. To do this the system must keep information about the changes that were applied to the data item by the various transactions. This information is kept system log.

These properties are responsible for one of the components of DMBS,

Property Recovery Management Component
1. Atomicity Recovery manager
2. Consistency User programmer
3. Isolation Concurrency control system
4. Durability Recovery manager

Transaction states

A transaction moves from one state to the other as it entries the system to be executed. A transaction must be in one of the following states:

  1. Active
    A transaction is said to an active state if the instruction is executing.
  2. Partially committed
    Partially committed state means that all the instructions are executed but changes are temporary and not updated in the database.
  3. Committed
    When changes are made permanent than it is said to be committed.
  4. Failed
    If any problem is detected either during active state or partially committed state than transaction enters in a failed state.
  5. Aborted
    Aborted state means all the changes that were in the local buffer are deleted. Either we are committed or aborted database is consistent.
Transaction in Database Management System

Related Tutorials


Comments and Discussions!

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© some rights reserved.