Make SQL transactions safe under concurrency
8 steps · about 2 h 6 min · Intermediate
- Frame a transaction (article, PostgreSQL documentation, 14 min)
Start with atomic units of database work.
- Compare isolation levels (article, MySQL documentation, 20 min)
Connect each isolation level to anomalies it permits or prevents.
- Lock rows intentionally (article, PostgreSQL documentation, 18 min)
Use explicit locks when a read-then-write invariant needs protection.
- Understand MVCC snapshots (article, PostgreSQL documentation, 18 min)
See why concurrent readers and writers can proceed together.
- Select rows for update (article, SQLite documentation, 15 min)
Practice reserving work without locking an entire table.
- Handle serializable retries (article, PostgreSQL documentation, 16 min)
Treat a serialization failure as a retryable outcome, not a mystery.
- Compare SQLite transaction modes (article, SQLite documentation, 15 min)
See how deferred, immediate and exclusive modes differ.
- Set a clear transaction start (article, PostgreSQL documentation, 10 min)
Make transaction scope visible in application code.