Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardSQLisolation levels and anomaliesSingle-choice MCQ

The 'write skew' anomaly is the canonical reason snapshot isolation is weaker than serializable. Consider this on-call scheduling example at SNAPSHOT/REPEATABLE READ. What goes wrong?

-- Invariant: at least 1 doctor on call. Currently Alice + Bob both on_call=true. -- T1 (Alice): SELECT count(*) FROM doctors WHERE on_call; -- sees 2 UPDATE doctors SET on_call=false WHERE name='Alice'; -- T2 (Bob), concurrent, same snapshot: SELECT count(*) FROM doctors WHERE on_call; -- also sees 2 UPDATE doctors SET on_call=false WHERE name='Bob'; -- both COMMIT under REPEATABLE READ