DBMS Topics
Transaction States
Last Updated : 21 May, 2026
A transaction passes through a series of well-defined states during its lifetime. The DBMS tracks the state of every transaction to manage concurrency and recovery correc
Overview
A transaction passes through a series of well-defined states during its lifetime. The DBMS tracks the state of every transaction to manage concurrency and recovery correctly.
Transaction State Diagram
State Descriptions
1. Active
The transaction is currently executing — reading and writing data items.
- Initial state when a transaction begins
- Remains active while operations are being performed
- Transitions to "Partially Committed" after last operation, or "Failed" on error
| A | = A - 1000; |
| B | = B + 1000; |
| write(B); ← last operation | next state |
2. Partially Committed
The transaction has executed its last operation but changes have NOT yet been permanently written to disk.
- All operations complete, but output in memory buffers only
- DBMS is in process of writing changes to stable storage
- If write succeeds → moves to Committed
- If I/O error or system crash occurs here → moves to Failed
3. Committed
The transaction has successfully completed and all changes are permanently stored on stable disk.
- Changes are now durable — survive future failures
- Transaction is done; resources are released
- Log record written:
<T, COMMIT>
4. Failed
The transaction cannot proceed due to an error or failure.
Causes:
- Hardware failure (disk crash, power loss)
- Software error (bug in transaction logic)
- Logical error (constraint violation, divide by zero)
- Concurrency control decision (deadlock victim)
- Manual cancellation
Transition: Failed → Aborted (after rollback)
5. Aborted
The transaction has been rolled back — all changes made by the transaction are undone, and the database is restored to its state before the transaction began.
After abort, the system has two choices:
- Restart the transaction (if failure was due to external cause like hardware)
- Kill the transaction (if failure was due to internal logical error)
State Transition Summary
| Transition | Trigger |
|---|---|
| Active → Partially | Last operation of transaction completes |
| Active → Failed | Error during execution |
| Partially Committed → | All changes written to stable storage |
| Partially Committed → | I/O error, failure while writing |
| Failed → Aborted | Rollback (undo) completes |
Compensating Transaction
After an abort, the DBMS executes a compensating transaction — a set of operations that logically undoes the effects of the aborted transaction.
For a write(X, new_val) that was part of an aborted transaction, the compensation is write(X, old_val) to restore the previous value.
Exam Focus
Revise definitions, diagrams, examples, and short-answer points for Transaction States.
Interview Use
Prepare one clear explanation, one practical example, and one common mistake for this DBMS topic.
Search Terms
dbms, database management system, database notes, sql, unit, transaction, states, transaction states
Related DBMS Topics