Sie sind auf Seite 1von 10

TRANSACTION

Collection of operations that form a single logical unit of work are called Transactions. A collection of several operations on the database appears to be a single unit from the point of view of the database user.

TRANSACTION (Contd.)
EXAMPLE:
A Transfer of funds from a checking account to a saving account is a single operation from the customers standpoint.
Read (A); A=A-50; Write (A); Read (B); B=B+50; Write (B);

ACID Properties
1) ATOMICITY:

Either all operations of a transaction are reflected properly in the database or all of its effects are aborted.

ACID Properties (contd.)


Example:
Suppose that, just before the execution of transaction T1, the values of accounts A & B are Rs.1000 and Rs.2000 resp. Now suppose that, during the execution of transaction T1, a failure occurs that prevents T1 from completing its execution successfully.

ACID Properties (contd.)


2) CONSISTENCY:

Execution of a transaction in isolation (that is, with no other transaction executing concurrently) preserves the consistency of the database.

ACID Properties (contd.)


Example:
T1: read (A); A= A-50; Write (A); Read (B); B=B+50; Write (B);

Suppose that the failure happened after the write (A) operation but before the write(B) operation.

ACID Properties (contd.)


In this case, values of accounts A and B are Rs. 950 and Rs. 2000. The system destroy Rs. 50 as a result of this failure. So, a sum of A+B is no longer preserved. We term such a state as a inconsistent state.

ACID Properties (contd.)


3) ISOLATION:
The concurrent execution of different transaction program should behave towards the user and database, as if there were no concurrency in running them.

ACID Properties (contd.)


Example:
Even though multiple transactions may execute concurrently, the system guarantees that, for every pair of transaction T1 and T2, it appears to T1 that either T2 finished execution before T1 started or T2 started execution after T1 finished.

ACID Properties (contd.)


4) DURABILITY:
The result of successfully terminated i.e. committed transaction program, execution must persist in the state of database, irrespective of the other concurrently running transactions or system crashes that destroy the state of system produced by transaction.

Das könnte Ihnen auch gefallen