Skip to main content
  • Book
  • © 2021

MySQL Concurrency

Locking and Transactions for MySQL Developers and DBAs

Apress
  • Helps you identify and troubleshoot locking problems in MySQL

  • Provides six case studies demonstrating realistic locking conflicts

  • Explains the importance of transactions and their effect on locking

Buy it now

Buying options

eBook USD 54.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book USD 69.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Other ways to access

This is a preview of subscription content, log in via an institution to check for access.

Table of contents (18 chapters)

  1. Front Matter

    Pages i-xxiii
  2. Introduction

    • Jesper Wisborg Krogh
    Pages 1-30
  3. Monitoring Locks and Mutexes

    • Jesper Wisborg Krogh
    Pages 31-65
  4. Monitoring InnoDB Transactions

    • Jesper Wisborg Krogh
    Pages 67-81
  5. Transactions in the Performance Schema

    • Jesper Wisborg Krogh
    Pages 83-96
  6. Lock Access Levels

    • Jesper Wisborg Krogh
    Pages 97-104
  7. High-Level Lock Types

    • Jesper Wisborg Krogh
    Pages 105-122
  8. InnoDB Locks

    • Jesper Wisborg Krogh
    Pages 123-140
  9. Working with Lock Conflicts

    • Jesper Wisborg Krogh
    Pages 141-156
  10. Reducing Locking Issues

    • Jesper Wisborg Krogh
    Pages 157-170
  11. Indexes and Foreign Keys

    • Jesper Wisborg Krogh
    Pages 171-191
  12. Transactions

    • Jesper Wisborg Krogh
    Pages 193-202
  13. Transaction Isolation Levels

    • Jesper Wisborg Krogh
    Pages 203-218
  14. Case Study: Flush Locks

    • Jesper Wisborg Krogh
    Pages 219-230
  15. Case Study: Metadata and Schema Locks

    • Jesper Wisborg Krogh
    Pages 231-246
  16. Case Study: Record-Level Locks

    • Jesper Wisborg Krogh
    Pages 247-257
  17. Case Study: Deadlocks

    • Jesper Wisborg Krogh
    Pages 259-275
  18. Case Study: Foreign Keys

    • Jesper Wisborg Krogh
    Pages 277-296
  19. Case Study: Semaphores

    • Jesper Wisborg Krogh
    Pages 297-319
  20. Back Matter

    Pages 321-376

About this book

Know how locks work in MySQL and how they relate to transactions. This book explains the major role that locks play in database systems, showing how locks are essential in allowing high-concurrency workloads. You will learn about lock access levels and lock granularities from the user level as well as table locks to record and gap locks. Most importantly, the book covers troubleshooting techniques when locking becomes a pain point. 


Several of the lock types in MySQL have a duration of a transaction. For this reason, it is important to understand how transactions work. This book covers the basics of transactions as well as transaction isolation levels and how they affect locking. The book is meant to be your go-to resource for solving locking contention and similar problems in high-performance MySQL database applications. 


Detecting locking issues when they occur is the first key to resolving such issues. MySQL Concurrency provides techniques for detecting locking issues such as contention. The book shows how to analyze locks that are causing contention to see why those locks are in place. A collection of six comprehensive case studies combine locking and transactional theory with realistic lock conflicts. The case studies walk you through the symptoms to look for in order to identify which issue you are facing, the cause of the conflict, its analysis, solution, and how to prevent the issue in the future. 




What You Will Learn
  • Understand which lock types exist in MySQL and how they are used
  • Choose the best transaction isolation level for a given transaction
  • Detect and analyze lock contention when it occurs
  • Reduce locking issues in your applications
  • Resolve deadlocks between transactions
  • Resolve InnoDB record-level locking issues
  • Resolve issues from metadata and schema locks




Who This Book Is For


Database administrators and SQL developers who are familiar with MySQL and want to gain a better understanding of locking and transactions as well as how to work with them. While some experience with MySQL is required, no prior knowledge of locks and transactions is needed.

Authors and Affiliations

  • Hornsby, Australia

    Jesper Wisborg Krogh

About the author

Jesper Wisborg Krogh has worked with MySQL databases since 2006 both as a SQL developer and a database administrator, and for more than eight years as part of the Oracle MySQL Support team. He currently works as a database reliability engineer for Okta. He has spoken at MySQL Connect and Oracle OpenWorld on several occasions. In addition to his books, Jesper regularly blogs on MySQL topics and has authored approximately 800 documents in the Oracle Knowledge Base. He has contributed to the sys schema and four Oracle Certified Professional (OCP) exams for MySQL 5.6–8. Jesper holds a PhD in computational chemistry, lives in Sydney, Australia, and enjoys spending time outdoors walking, traveling, and reading. His areas of expertise include MySQL Cluster, MySQL Enterprise Backup (MEB), performance tuning, and the performance and sys schemas.

Bibliographic Information

  • Book Title: MySQL Concurrency

  • Book Subtitle: Locking and Transactions for MySQL Developers and DBAs

  • Authors: Jesper Wisborg Krogh

  • DOI: https://doi.org/10.1007/978-1-4842-6652-6

  • Publisher: Apress Berkeley, CA

  • eBook Packages: Professional and Applied Computing, Professional and Applied Computing (R0), Apress Access Books

  • Copyright Information: Jesper Wisborg Krogh 2021

  • Softcover ISBN: 978-1-4842-6651-9Published: 23 January 2021

  • eBook ISBN: 978-1-4842-6652-6Published: 22 January 2021

  • Edition Number: 1

  • Number of Pages: XXIII, 376

  • Number of Illustrations: 34 b/w illustrations

  • Topics: Database Management

Buy it now

Buying options

eBook USD 54.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book USD 69.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Other ways to access