Unit IV Transaction Processing
Unit IV Transaction Processing
Introduction to Transaction
Processing Concepts and Theory
UNIT- IV
Introduction to Transaction Processing
Concepts and Theory: Introduction to
Transaction Processing- Transaction and System
Concepts- ACID Properties-Characterizing
Schedules Based on Recoverability.
Transaction
• Transaction is a set of operations which are all
logically related
• Transaction is a single logical unit of work
formed by a set of operations
ACID properties
ACID properties
• In order to maintain consistency in a database,
before and after transaction, certain
properties are followed. These are
called ACID properties.
1. Atomicity
2. Consistency
3. Integrity
4. Durability
Atomicity
Atomicity mean that either the entire
transaction takes place at once or doesn’t
happen at all.
Atomicity is also known as the ‘All or nothing
rule’.
Atomicity
• Consider the following transaction T consisting
of T1 and T2: Transfer of 100 from
account X to account Y.
Consistency
• Consistency means that integrity constraints must be
maintained so that the database is consistent before and
after the transaction. It refers to correctness of a
database.
• Referring to the example above,
The total amount before and after the transaction must
be maintained.
Total before T occurs = 500 + 200 = 700.
Total after T occurs = 400 + 300 = 700.
Therefore, database is consistent. Inconsistency occurs in
case T1 completes but T2 fails. As a result T is incomplete.
Isolation
isolation refers to Transactions are often
executed concurrently (e.g., reading and
writing to multiple tables at the same time).
Isolation ensures that concurrent execution of
transactions leaves the database in the same
state that would have been obtained if the
transactions were executed sequentially.
.
Durability
• This property ensures that once the
transaction has completed execution, the
updates and modifications to the database are
stored in and written to disk and they persist
even is system failure occurs. These updates
now become permanent and are stored in a
non-volatile memory. The effects of the
transaction, thus, are never lost.
Operations in a transaction-
1. Read Operation
2. Write Operation
1. Read Operation
• Schedule A: r1(X); w1(X); r2(X); w2(X); c2; r1(Y); w1(Y); c1 (or a1)
• Schedule B: r1(X); w1(X); r2(X); w2(X); r1(Y); w1(Y); c1 (or a1); ...
Characterizing Schedules based on
Recoverability
Recoverable schedules can be further refined:
• Cascadeless schedule: A schedule in which a transaction
T2 cannot read an item X until the transaction T1 that last
wrote X has committed.
• The set of cascadeless schedules is a subset of the set of
recoverable schedules.