CS FundamentalsVery hardGATE CS (PYQ pattern)

Snapshot isolation with first-committer-wins: a transaction aborts at commit time if some other transaction that committed after it started (and before its own commit) wrote an item it also wrote. Transactions (start time, commit attempt time, write set): T1 (1, 5, {A}), T2 (2, 6, {B}), T3 (3, 7, {A, C}), T4 (6, 8, {C}), T5 (4, 9, {B}). Which transactions abort?

  1. A. T3 and T5
  2. B. T3, T4 and T5
  3. C. T3 only
  4. D. T5 only

Correct answer: A. T3 and T5

In commit order: T1 commits (5); T2 commits (6). T3 started at 3 and T1 committed A at 5, so T3 aborts. T4 started at 6; the only other writer of C was T3, which aborted, so T4 commits. T5 started at 4 and T2 committed B at 6, so T5 aborts. T4 would wrongly abort if the aborted T3's write were counted.

More DBMS and SQL questions

Exams that ask this topic