Transactions and concurrency
For engineers
Transactions, isolation levels, locks and idempotent writes, and the race conditions AI-written data code often misses
110 questions across four stages: Understand, Apply, Solve and Judge.
Try 5 questions
Practice items, not counted towards your mastery. No account needed.
Check yourself · 1 of 5
What does atomicity guarantee for a transaction?
Check yourself · 2 of 5
What is PostgreSQL's default isolation level?
Check yourself · 3 of 5
Which code shape is a read-modify-write race?
Check yourself · 4 of 5
What happens when a second transaction updates a row that another open transaction has already updated?
Check yourself · 5 of 5
What does it mean for a payment endpoint to be idempotent?
Topics
- Drawing transaction boundaries correctly5 min read · What atomicity guarantees, which writes belong in one transaction, and why calling an external API or a model inside one holds locks too long
- Isolation levels and the anomalies they allow5 min read · Read committed, repeatable read and serializable in PostgreSQL, lost updates, write skew, and serialization failures that must be retried
- Race conditions in AI-written data code5 min read · Read-modify-write counters, check-then-insert duplicates and balance updates that pass single-user tests but break under concurrent requests
- Row locks, deadlocks and lock timeouts5 min read · How row and table locks queue, reading pg_locks and deadlock logs, consistent lock ordering, and lock_timeout to fail fast
- Idempotent writes and safe retries5 min read · Idempotency keys, upserts with ON CONFLICT, the transactional outbox, and retries that never double-charge or double-send
Start here
- Transaction Isolation (PostgreSQL documentation) (opens in a new tab)DocsFree
What read committed, repeatable read and serializable allow, and why serialization failures must be retried.
- PostgreSQL: Explicit locking (opens in a new tab)DocsFree
Row and table lock modes, FOR UPDATE, and the section on deadlocks and lock ordering.
- Jepsen: Consistency models (opens in a new tab)ArticleFree
A map of isolation and consistency models and which anomalies each one allows.
Helps to know first
110 questions · last verified 2026-12