Homework 5 Solution

$30.00 $24.00

We will use the following transaction schedule S for this problem. T1 T2 read(A) write(A) read(A) read(B) commit read(B) write(B) commit Is S serial? Is S con ict serializable? If so, what are the equivalent serial schedules? Show your work using the swap method or the graph method. Look carefully at these three transactions T1,…

5/5 – (2 votes)

You’ll get a: zip file solution

 

Categorys:
Tags:

Description

5/5 – (2 votes)
  1. We will use the following transaction schedule S for this problem.

T1 T2

read(A)

write(A)

read(A)

read(B)

commit

read(B)

write(B)

commit

    1. Is S serial?

    1. Is S con ict serializable? If so, what are the equivalent serial schedules? Show your work using the swap method or the graph method.

  1. Look carefully at these three transactions T1, T2 and T3.

T1 T2 T3

write(A)

read(A)

write(B)

write(B)

write(B)

write(A)

read(B)

read(B)

  1. Construct the precedence graph for this schedule S.

  1. Is S con ict serializable? Justify the answer.

1

  1. Consider the relation BankAccount(acctno, money) where we store the amount of money in a, well, bank account, and acctno is the key. Suppose we execute the following three transactions.

T1:

SELECT SUM(money) FROM BankAccount;

COMMIT;

T2: In this transaction, the bank has lost its mind and gives everyone a $100 bonus to stimulate spending. But your professor (acctno = 7) gets an additional $1000 because he is cheap and the bank wants him to perform some transactions.

UPDATE BankAccount SET money = money + 100;

UPDATE BankAccount SET money = money + 1000 WHERE acctno = 7;

COMMIT;

T3: We some more money to account 7 in this transaction. We will also set acctno = 42 to $0 because he died and had some liens on his account.

UPDATE BankAccount SET money = money + 1000 WHERE acctno = 7; UPDATE BankAccount SET money = 0 WHERE acctno = 42;

COMMIT;

The BankAccount table originally has two tuples (7, 15000) and (42, 25000). Assume that individual SQL statements execute atomically.

    1. If all three transactions execute under the SERIALIZABLE isolation level, list all possible values that can be returned by T1. Explain your answer.

    1. If T1 executes under the READ UNCOMMITTED isolation level and T2 under REPEATABLE READ access level, and T3 under the SERIALIZABLE isolation level, list all possible values that can be returned by T1. Explain your answer.

2

Homework 5 Solution
$30.00 $24.00