Professional Documents
Culture Documents
INFO445: Advanced Database Design, Management, and Maintenance
INFO445: Advanced Database Design, Management, and Maintenance
Admin
Upcoming assignment(s)
Next Monday by noon
Lab Assignment #2
Last Time
QEPs
Optimization heuristics? How can understanding them help us to write more efficient queries?
Storing data
How is data stored and its implications? What DBMS components play a role?
Outline
Interface
Transaction Manager
SQL Commands
Transactions
What is a transaction? What is the rationale for executing transactions concurrently? What can go wrong if transactions are not interleaved properly? What four properties need to be ensured for transactions? How does a DBMS ensure these four properties? How does the DBMS enable you to control transactions?
6
Transaction Operations
What sequences of operations are needed for the following transactions (reads/writes)?
deposit $50 to A compute total balance for A and C check balance and withdraw $100 from A transfer $100 from A to C
To determine the appropriate order, the scheduler bases its actions on concurrency control algorithms, such as locking or time stamping methods
Discussed next time
Serializability
Schedule
Sequence of reads/writes by set of concurrent transactions
E.g., R1(a), R2(a), W2(a), W1(a)
Serial Schedule
Nonserial Schedule
Schedule where operations of each transaction are executed consecutively without any interleaved operations from other transactions Schedule where operations from set of concurrent transactions are interleaved Objective of serializability is to find nonserial schedules that allow transactions to execute concurrently without interfering with one another In other words, want to find nonserial schedules that are equivalent to some serial schedule; such a schedule is called serializable
Produces the same final state as a serial schedule
18
18
10
Conflicts
Might there be conflicts
If two transactions only read a data item? If two transactions either read or write completely separate data items? If one transaction writes a data item and another reads or writes same data item?
20
11
Example Conflicts
Lost update (blind write or WW conflict)?
T: transfer $100 from A to C S: transfer $100 from B to C
T R(A) R(B) W(A) W(B) R(C) R(C) S
W(C) W(C)
12
Example Conflicts
Inconsistent retrieval (dirty read or WR conflict)?
T: transfer $100 from A to C S: compute total balance for A and C
T R(A) W(A) R(A) R(C) R(C) S
W(C)
13
Example Conflicts
Unrepeatable reads (RW conflict)?
T: transfer $100 from A to C S: check balance and withdraw $100 from A
T R(A) R(A) W(A) R(C) R(A) W(C) W(A) S
14
Serializable Schedules
How do we resolve schedule conflicts? A schedule is conflict serializable if it is conflict equivalent to some serial schedule
i.e., can be transformed into a serial schedule by a series of swaps of nonconflicting actions
15
Conflict Resolution
Avoid lost update (blind write or WW conflict)?
T: transfer $100 from A to C S: transfer $100 from B to C
T R(A) R(B) W(A) W(B) R(C) R(C) S
W(C) W(C)
16
Conflict Resolution
Avoid inconsistent retrieval (dirty read or WR conflict)?
T: transfer $100 from A to C S: compute total balance for A and C
T R(A) W(A) R(A) R(C) R(C) S
W(C)
17
Conflict Resolution
Avoid unrepeatable reads (RW conflict)?
T: transfer $100 from A to C S: check balance and withdraw $100 from A
T R(A) R(A) W(A) R(C) R(A) W(C) W(A) S
18
19
Example
T3 T1 T2
20
Break
21
Activity I
22
Project Discussion
Each project
Status Report Challenges Design evolution How might understanding DBMS functionality influence future design evolution?
23
In Summary
Transaction operations need to be interleaved to improve performance
How is interleaving accomplished? How are conflicts identified? How are conflicts resolved? What is a precedence graph and what is its role?
24
25