© Jesper Wisborg Krogh 2021
J. W. KroghMySQL Concurrencyhttps://doi.org/10.1007/978-1-4842-6652-6_5

5. Lock Access Levels

Jesper Wisborg Krogh1  
(1)
Hornsby, NSW, Australia
 

In the first chapter where locks were introduced, there was no mention of how locks work. It would be possible to implement locking in the database by just allowing one query access at a time irrespective of what kind of work will be done. However, this would be woefully inefficient.

Keeping to the analogy of a traffic light, another approach is grant access based on what work will be done. A traffic light grants access to the intersection not just to one car at a time but to all driving in the same direction. Similarly, in a database, you distinguish between shared (read) and ...

Get MySQL Concurrency: Locking and Transactions for MySQL Developers and DBAs 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.