Write Skew
A subtle anomaly where two transactions read the same data, each writes something valid alone, but together break a rule.
Write skew is a concurrency anomaly that snapshot isolation allows: two transactions read an overlapping set of rows, each makes a decision valid on its own snapshot, and each writes a different row — but together they violate an invariant that neither transaction alone would break.
Worked example: two doctors are on call; both open a transaction, both read “2 doctors on call” (safe to go off), and both mark themselves off — leaving zero on call. Each write was individually fine; together they broke the “at least one on call” rule. Gotcha: write skew is invisible under snapshot isolation because the two transactions touch different rows (no write-write conflict to detect) — the fixes are serializable isolation, materializing the conflict (SELECT FOR UPDATE on a shared row), or an explicit constraint; it is a classic “passed all tests, broke in production under load” bug.