CS FundamentalsVery hardProduct-company placement · GATE CS

A hospital requires at least one doctor on call. Doctors Ana and Ben are both on call. Each starts a transaction under snapshot isolation, checks that the number of on-call doctors is at least 2, and then sets only their own row to off-call; both commit. What is the result?

  1. A. Both commit and nobody is on call (write skew)
  2. B. The second commit fails with a write-write conflict
  3. C. Snapshot isolation serialises them, so exactly one is still on call
  4. D. Both block forever waiting for each other's row lock

Correct answer: A. Both commit and nobody is on call (write skew)

Each transaction reads the same snapshot (2 on call) and writes a different row, so snapshot isolation's first-committer-wins check finds no write-write conflict. Both commit and the constraint breaks; only serializable isolation (e.g. SSI) or a lock on the read rows prevents this.

More DBMS and SQL questions

Exams that ask this topic