Opening Scenario

Your analytics dashboard shows a "total revenue today" counter. Two users reload it simultaneously. One sees $142,000; the other sees $141,850. A moment later, the first user reloads and sees $141,850 too — the same number the second user saw before the first user's initial read. Revenue didn't go down. Both reads happened while a large batch job was updating order totals.

Meanwhile, your inventory service is seeing a different problem: two customers are both buying the last unit of a popular item. Both reads confirm qty = 1. Both proceed to checkout. Both writes succeed. Quantity is now -1.

These are two different bugs, but they both come down to the same question: what exactly does one transaction see when another transaction is running concurrently?


Question Progression

Q1: What is the problem that isolation levels are solving?

Question: You have two concurrent transactions, T1 and T2, both reading and writing the same rows. What can go wrong if…

In the full tutorial

  • Closing: When to Reach for This

Glossary history

Click dotted jargon to save explanations here.