2. TRANSACTION INFO
• The transaction is a set of logically related operation. It contains a
group of tasks.
• A transaction is an action or series of actions. It is performed by a
single user to perform operations for accessing the contents of the
• Example: Suppose an employee of bank transfers Rs 800 from X's
account to Y's account. This small transaction contains several low-
5. These are different types of Transaction States :
1.Active State –
When the instructions of the transaction are running then the transaction is in active state. If all the ‘read and write’ operations are
performed without any error then it goes to the “partially committed state”; if any instruction fails, it goes to the “failed state”.
2.Partially Committed –
After completion of all the read and write operation the changes are made in main memory or local buffer. If the changes are made
permanent on the DataBase then the state will change to “committed state” and in case of failure it will go to the “failed state”.
3.Failed State –
When any instruction of the transaction fails, it goes to the “failed state” or if failure occurs in making a permanent change of data on
4.Aborted State –
After having any type of failure the transaction goes from “failed state” to “aborted state” and since in previous states, the changes
are only made to local buffer or main memory and hence these changes are deleted or rolled-back.
5.Committed State –
It is the state when the changes are made permanent on the Data Base and the transaction is complete and therefore terminated in
the “terminated state”.
6.Terminated State –
If there isn’t any roll-back or the transaction comes from the “committed state”, then the system is consistent and ready for new
transaction and the old transaction is terminated.
6. TRANSACTION ATOMICITY AND DURABILITY
Atomicity is a property that ensures that a database follows the all or
nothing rule. In other words, the database considers all transaction operations
as one whole unit or atom.
Thus, when a database processes a transaction, it is either fully completed or
not executed at all. If a single portion of the transaction fails, the whole
transaction will fail.
For example, user A wants to withdraw $50 from his account and then transfer
it to the account of user B. Each transaction (withdrawing $50 from account A
and transferring $50 to account B) is counted as separate. If the first
transaction (withdrawing $50) fails because (say) the server crashes during the
transaction, user A cannot transfer the money to user B.
Atomicity is particularly important to mitigate damage in case of database
server crashes. If a non-volatile database crashes in the middle of a transaction,
all changes done will be discarded or rolled back to avoid sending partial results
to the production database
Durability is a property that enforces completed transactions,
guaranteeing that once each one of them has been committed, it
will remain in the system even in case of subsequent failures.
If a transaction is successful, all changes generated by it are
In the above example, user B may withdraw $100 only after
user A’s transaction is completed and is updated in the database.
If the system fails before A’s transaction is logged in the
database, A cannot withdraw any money, and Z’s account
returns to its previous consistent state
8. TRANSACTION ISOLATION
Isolation is a property that guarantees the individuality of each transaction, and
prevents them from being affected from other transactions. It ensures that
transactions are securely and independently processed at the same time without
interference, but it does not ensure the order of transactions.
For example, user A withdraws $100 and user B withdraws $250 from user Z’s
account, which has a balance of $1,000. Since both A and B draw from Z’s account,
one of the users is required to wait until the other user transaction is completed,
avoiding inconsistent data.
If B is required to wait, then B must wait until A’s transaction is completed, and Z’s
account balance changes to $900. Now, B can withdraw $250 from this $900 balance