What can the other session see?
Correct SQL can still behave unexpectedly when two sessions act together. Transactions define atomic work; isolation controls what concurrent work can observe. Locks and waits explain operational behavior beyond a single query plan.
Decision reference
| Symptom or requirement | Investigate |
|---|---|
| Partial multi-step change | Transaction boundaries and rollback |
| Different results across reads | Isolation and snapshots |
| Two writers conflict | Locks, constraints, retry rules |
| Query waits despite a simple plan | Blocking sessions |
| Circular waiting | Deadlock detection and transaction order |
In this chapter
- ACID, commits & savepointsGroup related changes so failure does not leave partial work.
- Isolation levels & read anomaliesKnow which concurrent changes a transaction can observe.
- Locks, deadlocks & lost updatesProtect concurrent writes and recognize conflicting lock order.
Rehearse it as two sessions
Write the order of operations for session A and session B. Mark what each session can see, where it waits, and what happens on retry. Concurrency problems are easier to explain as a timeline than as isolation-level definitions.