Transaction Processing Concepts - DBMS Notes
1. Transaction and System Concepts
A transaction is a logical unit of work in a database that must be executed completely or not at all.
Example: Transferring money between bank accounts requires debit and credit operations to occur
together.
2. Properties of Transactions (ACID)
Property Meaning Example
Atomicity All operations happen or none do. Order placed fully or not at all.
Consistency Database moves from one valid state to another.
Stock decreases when order is placed.
Isolation Concurrent transactions do not interfere. Two people can't buy the last item simultaneously.
Durability Once committed, effects are permanent. Order remains even if power fails.
3. Recoverability
A schedule is recoverable if no transaction commits until all transactions whose changes it read
have committed. This prevents dirty reads and cascading rollbacks.
4. Serializability
Serializability ensures that concurrent execution of transactions results in a state that could be
obtained by some serial execution. Types: Conflict Serializability (based on conflicting operations)
and View Serializability (based on same results and data visibility).
5. Concurrency Control Techniques
Technique Description
Lock-Based Protocols Transactions lock data items before using them (shared/exclusive locks). Common: T
Timestamp-Based Protocols Transactions ordered by timestamp; avoids deadlocks but may cause rollbacks.
Optimistic Concurrency Control Assumes conflicts are rare; validates before writing.
MVCC Multiple versions of data allow readers and writers to proceed without blocking.
6. Locking Techniques
Locks prevent conflicting operations. Shared (S) lock allows reads; Exclusive (X) lock allows
read/write. Two-Phase Locking has Growing and Shrinking phases. Variants include Strict 2PL and
Rigorous 2PL.
S X
S Yes No
X No No
7. Concurrency Control based on Time-Stamp Ordering
Each transaction gets a timestamp at start. For each data item Q, maintain RTS(Q) and WTS(Q).
Rules for Read(Q) and Write(Q) prevent timestamp violations. Advantages: no deadlocks;
Disadvantages: more rollbacks.
Feature Locking Timestamp Ordering
Deadlocks Possible Not possible
Rollback Frequency Lower Higher
Blocking Yes No
Serializability Guarantee If protocol followed Always by timestamp order