What is a Transaction?
Slide 2
What is a Transaction?
Slide 3
Slide 4
Slide 5
Transaction Processing
Slide 6
Transaction Properties
Atomicity
Durability
Slide 7
Transaction Properties
Serializability
Isolation
Slide 8
Slide 9
2.
3.
4.
Slide 10
Slide 11
Slide 12
A Transaction Log
Slide 13
Concurrency Control
Slide 14
Concurrency Control
lost updates
uncommitted data
inconsistent retrievals
Slide 15
Slide 16
Lost Updates
Slide 17
Slide 18
Slide 19
Slide 20
Slide 21
Slide 22
Slide 23
Inconsistent Retrievals
Slide 24
The Scheduler
Slide 25
Slide 26
Slide 27
Lock
Lock manager
Slide 28
Lock Granularity
Database-level lock
Slide 29
Slide 30
Table-Level Lock
T1 and T2 can access the same database concurrently as long as they use different tables
Can cause bottlenecks when many transactions are trying to access the same table (even if the
transactions want to access different parts of the table and would not interfere with each other)
Not suitable for multi-user DBMSs
Slide 31
Page-Level Lock
An entire disk page is locked (a table can span several pages and
each page can contain several rows of one or more tables)
Most frequently used multi-user DBMS locking method
Slide 32
Row-Level Lock
Slide 33
Field-Level Lock
Slide 34
Binary Locks
Slide 35
Shared/Exclusive Locks
Exclusive lock
Access is specifically reserved for the transaction that locked the object
Must be used when the potential for conflict exists when a transaction
wants to update a data item and no locks are currently held on that
data item by another transaction
Granted if and only if no other locks are held on the data item
Shared lock
Multiple transactions can each have a shared lock on the same data
item if they are all just reading it
Only one transaction at a time can own an exclusive lock in the same
object
Slide 36
Shared/Exclusive Locks
Increased overhead
Slide 37
Slide 38
Slide 39
Slide 40
Deadlocks
Control through
Prevention
Detection
Avoidance
Slide 41
Slide 42
Monotonicity
Disadvantage
Slide 43
Wait/die
Wound/wait
Slide 44
Slide 45
Optimistic approach
Slide 46
Slide 47
Database recovery
Slide 48
Transaction Recovery
Slide 49
Transaction Recovery
Deferred write
Slide 50
Transaction Recovery
Write-through
Slide 51
Slide 52
T106 represents a credit sale of 1 unit of 89-WREQ to customer 10016 for $277.55 This transaction
consists of 3 INSERT and 2 UPDATE statements
Slide 53
Slide 54