A database almost never runs your request alone. At any instant thousands of transactions â transfers, orders, ticket bookings â are reading and writing the same rows. Running them strictly one at a time would be safe but unbearably slow, so the database interleaves them.
The catch: the result must look as if they had run one after another, in some order. That property is called serializability. If a schedule is serializable, every account balance, seat count and inventory total is exactly what a sane sequential run would have produced. If it is not, money appears from nowhere, two people buy the same seat, and the books no longer balance.
So the database faces a question on every commit: this messy interleaving I just allowed â is it equivalent to some clean sequential order, or not? Remarkably, that question has a crisp, fast answer, and it lives in a little graph.
Comments
Loading comments...