Friday 13 September 2013

What is Transaction (Its ACID Property)

A transaction is a Logical unit of work that compromises one or more SQL Statements executed by a single User. According to ANSI, a transaction begins with first executable statement and ends when it is explicitly committed or rolled back. A transaction is an atomic unit of work that either fails or succeeds. There is no such thing as a partial completion of a transaction. Since a transaction can be made up of many steps, each step in the transaction must succeed for the transaction to be successful. If any one part of the transaction fails, then the entire transaction fails. When a transaction fails, the system needs to return to the state that it was in before the transaction was started. This is known as rollback. When a transaction fails, then the changes that had been made are said to be "rolled back." In effect, this is acting similar to the way the Undo command works in most word processors. When you select undo, the change that you just may have made is reversed. The transaction processing system is responsible for carrying out this undo.
When a transaction processing system creates a transaction, it will ensure that the transaction will have certain characteristics. ACID is an acronym for atomicity, consistency, isolation, and durability.
An atomic transaction is either fully completed, or is not begun at all.
A transaction enforces consistency in the system state by ensuring that at the end of any transaction the system is in a valid state.
When a transaction runs in isolation, it appears to be the only action that the system is carrying out at one time.
A transaction is durable in that once it has been successfully completed; all of the changes it made to the system are permanent.

No comments:

Post a Comment