Professional Documents
Culture Documents
Properties & States of Transaction
Properties & States of Transaction
INTRODUCTION TO MYSQL
What is a transaction ?
Transaction group a set of tasks into a single execution unit. Each transaction begins with a
specific task and ends when all the tasks in the group successfully complete. If any of the
tasks fail, the transaction also fails. Therefore , a transaction has only two results :
Success or Failure.
Incomplete steps result in the failure of the transaction. A database transaction by definition
must be atomic, consistent, isolated and durable. These are popularly known as ACID
properties.
Properties of Transaction :
To maintain data integrity & consistency when concurrent execution of transaction takes
place, each transaction must satisfy the ACID property.
A-Atomicity
C-Consistency
I-Isolation
D-Durability
Atomicity :-
A transaction is said to be atomic if a transaction always executes all of its operations in one
step or not execute any operations at all.
Consistency :-
A transaction must preserve the consistency of a database after it’s execution.
That means, the execution of transaction must leave a database in either of it’s prior state or
a new stable state.
Isolation :-
If there are multiple transactions executing simultaneously, then all the transactions should
be processed as if they are single transaction.
Each individual transactions should not alter or affect the other executing transactions.
That means each transaction should be executed as if they are independent.
Durability :-
Once the execution of the transaction completes successfully all the updates that are carried
out on the database persists even if there is a system failure.
Once a transaction commits, the system must guarantee that the results of its operations
will never be lost.
Permanent
PARTIALLY COMMITTED
Read/ write COMMITTED state
ACTIVE TERMINATED
Failure
FAILED Rollback ABORTED
Partially committed :-
When all the operations of the transactions has been completed, it goes to partially
committed state. At this point the updates / changes made by the transaction still reside
in the buffer / local memory.
Committed :-
At this point all the updates/ changes made by the transactions has been properly
reflected on the disk from the buffer. Once a transaction is committed, the changes will
persist even if the system failure occurs.
Failed:-
If the normal execution of the transaction could not proceed then the transaction goes
into the failed state.
Aborted :-
Once a transaction fails to complete its execution, all the changes made by the transaction
on the database must be undone. At this point the transaction goes into the aborted
state.
Terminated :-
Once, the transaction leaves the system, it is said to be terminated. A transaction enters
into the terminated state if it has either committed or aborted.