Skip to content
Preptima
hardConceptMidSeniorStaff

Two transactions each check a rule, then both commit changes that break it, and neither overwrote the other's row. What happened?

5 min readUpdated 2026-08-15Target archetype: Big Tech, Enterprise Captive, Product Startup

Answer

Short answer

This is write skew. Both transactions read the same snapshot, decide independently, and write disjoint rows, so there is no write-write conflict for the engine to catch. The invariant spanned rows it never saw as related, so either make the conflict physical or use true serialisability.

Was this answer helpful?

Likely follow-ups

  • Where does PostgreSQL's serialisable snapshot isolation decide to abort, and how would you size a retry policy around it?
  • Which invariants can be pushed into a unique or exclusion constraint, and which cannot be expressed that way at all?
  • How does this same schedule behave under read committed, and why is that not an improvement?
  • If you take a locking read on every row you read, what new failure mode have you bought?

Related questions

Further reading