CS FundamentalsVery hardProduct company interview · GATE level

A SERIALIZABLE transaction in PostgreSQL (which uses Serializable Snapshot Isolation, SSI) can occasionally abort with a serialization failure even though it did nothing 'wrong' on its own. Why might this legitimately happen?

  1. A. It only happens if the transaction explicitly requests an abort
  2. B. PostgreSQL's SERIALIZABLE is identical to READ COMMITTED, so this cannot happen
  3. C. It is always a bug in PostgreSQL that should be reported
  4. D. SSI monitors for patterns of concurrent reads/writes among transactions that COULD produce a non-serializable outcome (like write skew) and proactively aborts one of them, even if, in this particular run, the actual values involved wouldn't have caused a real anomaly — this is a conservative, sound-but-not-complete mechanism

Correct answer: D. SSI monitors for patterns of concurrent reads/writes among transactions that COULD produce a non-serializable outcome (like write skew) and proactively aborts one of them, even if, in this particular run, the actual values involved wouldn't have caused a real anomaly — this is a conservative, sound-but-not-complete mechanism

True serializability enforcement (as opposed to just forbidding the three named anomalies) is undecidable to check perfectly and cheaply at runtime, so SSI uses a conservative approximation: it tracks certain read/write dependency patterns (rw-antidependencies) that COULD lead to a serialization anomaly and aborts a transaction when such a pattern is detected, even in some cases where the actual run would have been fine — a known, accepted cost of guaranteeing true serializability efficiently.

More DBMS and SQL questions

Exams that ask this topic