Data & storage · Intermediate · 12 min

Transactions & Isolation

Follow a multi-record decision and see why atomic writes alone may not protect it.

STEP 1 / 13
Read the last available seat — isometric concept diagramIdentify the invariant that concurrent operations must preserve. Components: 1. Buyer A. Representative clients, not a literal user count; 2. Transaction A. Logical component or processing boundary; 3. Seat records. Durable or explicitly scoped state. Connections: 1. Buyer A to Transaction A: Read the last available seat; 2. Transaction A to Buyer A: Reply: Transaction A; 3. Transaction A to Seat records: Read the last available seat; 4. Seat records to Transaction A: Reply: Seat records. Illustrations are conceptual, not deployed capacity or user counts.Buyer A → Transaction A: Read the last available seat1Transaction A → Buyer A: Reply: Transaction A2Transaction A → Seat records: Read the last available seat3Seat records → Transaction A: Reply: Seat records4Buyer A: Representative clients, not a literal user count1Buyer ARepresentative clients, not aliteral user countTransaction A: Logical component or processing boundary2Transaction ALogical component or processingboundarySeat records: Durable or explicitly scoped state3Seat recordsDurable or explicitly scoped state
1Buyer A2Transaction A3Seat records
  1. 1Buyer A → Transaction ARequestRead the last available seat
  2. 2Transaction A → Buyer AReplyReply: Transaction A
  3. 3Transaction A → Seat recordsRequestRead the last available seat
  4. 4Seat records → Transaction AReplyReply: Seat records

Conceptual illustration · figures do not imply user counts, deployed capacity or replica counts.

3 components visible · Buyer A + Transaction A + Seat records highlighted

Orange: request / query · Blue: reply · Purple: event / control · Arrows show direction; speed is illustrative.

You’ll learn

  • Atomicity and isolation solve different problems.
  • A stable read snapshot is not automatically serial execution.
  • Protect the invariant’s whole decision boundary.

PUT THE IDEA TO WORK

From learning to practice

RELATED PATTERNS

Explore architecture patterns ↗

Further reading

PostgreSQL · Transaction isolation ↗