Transactions and Concurrency

In multiuser systems, more than one user and/or transaction can access the same data at the same time. Preventing simultaneous transactions from interfering with each other—controlling concurrency—means making sure that data is not seen or operated on by another user until a change is complete.

The purchase of airline tickets provides a classic example of one of the situations in which concurrency can be a problem. (It's so classic that it has a name: the lost-update problem.)

Suppose you call your favorite airline and ask for a ticket to Tahiti. The ticketing clerk submits a query to the database that selects all the available seats and tells you that there's one seat left on tonight's flight. As you ponder, another ...

Get Practical SQL Handbook, The: Using SQL Variants, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.