Transaction isolation levels 31 Consider the following Accou
Transaction isolation levels:
3.1) Consider the following Account table
Assume the following two transactions are submitted:
T1: adds $1000 to account 1
T2: makes account 2 balance equals to account 1 balance
a) What are the final database contents for each of the following possible scenarios
b) What are the final database contents after executing the following schedule for each of the following isolation levels? Explain why or why not the two isolation levels results in different final values in the database.
| accNum | bal |
| 1 | 1000 |
| 2 | 0 |
Solution
a)
b)
for T1 bal = 1000
for T2 bal = 1000
for T1 bal = 0
for T2 bal = 0
for T1 bal = 2000
for T2 bal = 2000
for T1 bal = 0
for T2 bal = 2000
for T1 bal = 1000
for T2 bal = 1000
for T1 bal = 0
for T2 bal = 0
| accNum 1 | accNum 2 | |
| Neither transaction completes its work | 1000 | 0 |
| Only T1 completes its work | 2000 | 0 |
| Only T2 completes its work | 1000 | 1000 |
| Serial execution T1 T2 | 2000 | 2000 |
| Serial execution T2 T1 | 2000 | 1000 |
