Every time you open a bank app or book a flight, your request lands inside a transaction — a block of reads and writes that the database promises to treat as a single unit. But thousands of transactions run at the same moment, and letting them trample each other's work leads to corrupted data.
The simplest fix — a global lock that lets only one transaction run at a time — is safe but crushes performance. Databases instead pick an isolation level: a precise contract that spells out which concurrency anomalies can still happen in exchange for speed.
Snapshot isolation is one of the most popular choices. The idea is elegant: when your transaction starts, the database takes a frozen snapshot of every committed value. For the rest of the transaction, all your reads come from that snapshot — as though the rest of the world paused. You can never see a half-written update from a concurrent transaction, and you will never observe the same row changing value during your own work.
For decades this felt like a perfect solution. Then, in 1995, researchers at Microsoft showed that two transactions, each reading a perfectly consistent snapshot, can together write a result that no serial execution of those same transactions could ever have produced. That anomaly has a name: write skew. Understanding it — and the class of problems it represents — is the subject of this article.
Comments
Loading comments...