Thursday , March 28 2024
If you like to open the box and see how things work then Understanding MySQL Internals is your ticket to the big top.

Book Review: Understanding MySQL Internals by Sasha Pachev

According to the author, Sasha Pachev, although MySQL source is open in the sense of being publicly available, it is really closed if you do not understand how it works and what it does. It is very intimidating to look at several hundred thousand lines of code written by gifted programmers. But to understand that code will take a measure of the inspiration and perspiration of those who created it.

Let's face facts — on the surface, the concept of a relational database is a simple one, but when you get down to putting the rivets on the plane, there are a lot of them and if you miss some, well you know what happens to planes without all their rivets.

Understanding MySQL Internals is thin in size, but thick in details. It contains twelve chapters and an index. This book is for developers who want to extend MySQL, the DBA who wants to get a better handle on how things run, or the computer science student wanting a better understanding of database kernel development.

Chapter 1, "MySQL History and Architecture," gives an introduction to how the different components of MySQL server work together. By learning the history of MySQL, you will gain a better understanding of its architecture. Chapter 2, "Nuts and Bolts of Working with the MySQL Source Code," will walk you through how to get the software downloaded and then build it from the source. The source is the ultimate documentation.

Chapter 3, "Core Classes, Structures, Variables, and APIs," describes the core server classes by listing the basic data structures, functions, and macros that you will need later in the book. Chapter 4, "Client/Server Communication," explains the communications protocol that is used between the client and the server. Here you will learn how to look at a binary dump of that communication and see what happened.

Chapter 5, "Configuration Variables," discusses the server configuration variables. These are the controls of the server. Each and every one tells you something about some special server capability. This is a good base for the DBA since if you understand the variables, you understand the server.

Chapter 6, "Thread-Based Request Handling," exposes the thread-based handling that goes on in MySQL. By understanding threads, you will become much more effective in handling the server. You will learn the rationale for implementing thread-based request handling.

Chapter 7, "The Storage Engine Interface," focuses on the storage engine interface and how it works within the MySQL Architecture to integrate third party storage engines. This is the mechanism that actually stores and retrieves the data. Here you will learn about the handler class and the handlerton structure.

Chapter 8, "Concurrent Access and Locking," looks at the table lock manager. Although the current version of MySQL supports a number of page and row locking storage engines, its history still goes back to the old MyISAM days and is important to the understanding of the system.

Chapter 9, "Parser and Optimizer," will show you the core of how to optimize your queries if you are a DBA trying to fine tune your system. Since this server module is responsible for creating and executing the plan to retrieve the records requested, it becomes important to understand if you want it processed in the least amount of time.

Chapter 10, "Storage Engines," provides you with an overview of the MySQL storage engines. Because there are so many, he only focuses on a few and points you to where you can find out more on some of the others.

Chapter 11, "Transactions," is provided for the developer who wants to learn how to integrate a transactional storage engine into MySQL. Here the author uses the InnoDB as an example to show why things are done.

Chapter 12, "Replication," focuses on MySQL Server's straightforward approach to replication. A server may act as a master or a slave in which the master maintains a log of updates. The slave connects to the master and starts executing the updates as it reads them.

Understanding MySQL Internals provides a very good introduction to the internals of MySQL Server. Being a former member of the MySQL development team from 2000 to 2002 and the original developer of replication in MySQL, Pachev holds a lot of expertise and credibility. My only complaint with the book is that in the set-up and compile, he only explains the Linux version. Since there are a lot of MySQL users on other platforms, some attention should have at least been addressed, and some direction given, to finding the additional information.

That said, if you are a programmer wanting to customize MySQL for specific use, a DBA wanting to optimize your queries or truly understand the inner workings, or if you just like to open the box and see how things work, then Understanding MySQL Internals is your ticket to the big top.

About T. Michael Testi

Photographer, writer, software engineer, educator, and maker of fine images.

Check Also

SXSW

SXSW 2023: Connecting Your Brain to Computers

Brain Computer Interface technology will allow you to control the world with just your thoughts and bluetooth.