Identify, analyze, and improve poorly performing queries that damage user experience and lead to lost revenue for your business. This book will help you make query tuning an integral part of your daily routine through a multi-step process that includes monitoring of execution times, identifying candidate queries for optimization, analyzing their current performance, and improving them to deliver results faster and with less overhead. Author Jesper Krogh systematically discusses each of these steps along with the data sources and the tools used to perform them. MySQL 8 Query Performance Tuning aims to help you improve query performance using a wide range of strategies. You will know how to analyze queries using both the traditional EXPLAIN command as well as the new EXPLAIN ANALYZE tool. You also will see how to use the Visual Explain feature to provide a visually-oriented view of an execution plan. Coverage of indexes includes indexing strategies and index statistics, and you will learn how histograms can be used to provide input on skewed data distributions that the optimizer can use to improve query performance. You will learn about locks, and how to investigate locking issues. And you will come away with an understanding of how the MySQL optimizer works, including the new hash join algorithm, and how to change the optimizer’s behavior when needed to deliver faster execution times. You will gain the tools and skills needed to delight application users and to squeeze the most value from corporate computing resources. What You Will LearnMonitor query performance to identify poor performersChoose queries to optimize that will provide the greatest gainAnalyze queries using tools such as EXPLAIN ANALYZE and Visual ExplainImprove slow queries through a wide range of strategiesProperly deploy indexes and histograms to aid in creating fast execution plansUnderstand and analyze locks to resolve contention and increase throughputWho This Book Is ForDatabase administrators and SQL developers who are familiar with MySQL and need to participate in query tuning. While some experience with MySQL is required, no prior knowledge of query performance tuning is needed.
Of the existing MySQL performance tuning resources, this is the most complete one I've seen. MySQL 8 has been out for a while now, and this book will get you up-to-date on tuning it.
The author starts with a high-level overview of tuning and benchmarking. With 900+ pages to work with, he has taken time to give this theoretical overview, but also highly specific details, with screenshots, diagrams, and terminal output for nearly every concept and tool mentioned.
The second section provides an in-depth tour of sources of information for tuning. This section includes the missing documentation for tools like sys schema and performance schema; I haven't seen depth and detail like this about these tools anywhere else.
Section three is a deep dive into available tools. A lot of performance guides miss the latest Oracle tools for monitoring and tuning, like MySQL Shell and histograms. The author has described them here in detail. However, he didn't forget to include the available open-source tools like ProxySQL.
Finally, in the fourth and fifth sections, the author discusses real-world application of the tools: query analysis, diagnosing lock contention, replication, etc.
This would be a regularly accessed guide on any DBA's bookshelf.