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

17. Case Study: Foreign Keys

Jesper Wisborg Krogh1  
(1)
Hornsby, NSW, Australia
 

One of the more difficult lock contention cases to investigate happens when foreign keys are involved as you can have queries on different table content for the same locks. This case study investigates an example where both metadata and InnoDB record locks occur due to foreign keys. As the symptoms and the cause are the same as for the case study discussing metadata locks in Chapter 14 and the case study of the InnoDB record locks in Chapter 15, these are skipped in this discussion.

The Setup

This case study is more complex than the previous ones, and there is not a simple ...

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.