10 Transaction Management
10 Transaction Management
Database Systems
(CS F212)
by
Dr.Shubhangi
Dept. of CS and IS
Property of Component
transaction
Atomicity Transaction Management Component
Consistency Application Programmer
Isolation Concurrency Control Component
Durability Recovery Management Component
Types of failures
• Computer Failure : A H/W or S/W error in the
computer during transaction execution.
• Aborted, after the transaction has been rolled back and the
database restored to its state prior to the start of the
transaction. Two options after it has been aborted:
– restart the transaction – only if no internal logical error
– kill the transaction
T1 T2 … Tn
DB
(consistency
constraints)
• Advantages :
– increased processor and disk utilization, leading to
better transaction throughput: one transaction can be
using the CPU while another is reading from or writing
to the disk
– reduced average response time for transactions: short
transactions need not wait behind long ones.
Concurrent Executions
Concurrency control schemes – mechanisms to
achieve isolation,
i.e., to control the interaction among the
concurrent transactions in order to prevent them
from destroying the consistency of the database
Schedules
• Schedules – sequences that indicate the order
in which instructions of concurrent
transactions are executed
– a schedule for a set of transactions must consist of
all instructions of those transactions
– must preserve the order in which the instructions
appear in each individual transaction.
Example
• Consider two transactions (transactions) :
T1: BEGIN A=A+1500, B=B -1500 END
T2: BEGIN A=1.06*A, B=1.06*B END
T1 Fails
Anomalies due to interleaved executions
• Reading Uncommitted data (WR Conflicts)
(Dirty read problem) (due to temporary
updates)
– Eg: T2 reads the data updated by T1 and T1 fails before completing.
Thus T2 reads dirty data.
T2
y x y,z
T1 T3
y