Verdict: Recommended with reservations
When I started reading this book, I was expecting a guide to using SQL – in particular, I was reading it from the point of view of a programmer who expects to write systems that invoke SQL Queries that ran on the MySQL RDBMS (or similar). I had just finished reading Learning PHP, MySQL & JavaScript and was looking to improve my SQL skills. It is relevant to MySQL (both Community Edition and Enterprise Edition), MariaDB and Percona Server. The book is split into four main parts:
- Starting with MySQL
- Using MySQL
- MySQL In Production
- Miscellaneous Topics
It covers both development and operations aspects of MySQL and where MySQL differs from other dialects of SQL. It is not a one-stop shop, though. I found parts of it quite confusing, so I had to use the Internet (Wikipedia, dev.mysql.com, www.w3schools.com/sql) to get a better idea of the concepts being presented. It uses a number of example databases and has links to follow to download the MySQL script files to install those databases on the readers’ system and an accompanying MySQL Workbench file (.mwb). A full chapter on the MySQL Workbench Tool would have been welcome. Failing that, the reader should consult https://dev.mysql.com/doc/workbench/en/. Screenshots of MySQL Workbench displaying the structure of the example databases are best avoided and the actual MySQL Workbench (.mwb) files should be viewed instead.
The Sakila database for a DVD rental company is the main example database and a chapter on this, also, would have been helpful – it is possible to dig into the structure of the database using the MySQL command line client – I spent an afternoon doing just that. There is a diagram of the Sakila database in the book but it is a very cramped screenshot of the MySQL workbench file – it is a much better idea to use the actual MySQL Workbench file rather than the screenshot. I later on discovered that the Sakila database is documented on the MySQL website which made things clearer and had a much clearer diagram: https://dev.mysql.com/doc/sakila/en/sakila-structure.html.
The ‘Advanced Querying’ chapter introduces multiple inner joins in queries with examples but could do more to show the reader how to parse a complicated SQL query in general – some of that information is provided, scattered throughout this book. There is much of interest in this chapter. ‘Transactions and Locking’ covers isolation levels which details strategies in handling concurrent events.
On the operations side of things, this book covers installing MySQL on Linux, Apple, and Windows. I was pleasantly surprised to see that it advocated installing the software using Linux Package Managers, something not always done. The operations chapters cover many things – running MySQL on a single server through to running MySQL on multiple machines (High-Availability, source-replica architecture).
‘Doing more with MySQL’ is a mixed bag of ops-related stuff covering bulk loading of data (especially CSV files), the EXPLAIN statement, and alternative storage engines. A whole chapter (40+ pages long) is devoted to ‘Managing Users and Privileges’. Other aspects of ops – configuring MySQL, Backing Up and Recovering databases, Configuring and Tuning the Server, and Load Balancing MySQL all have their own chapters.
‘Monitoring MySQL Servers’ is an unexpected gem. It covers O.S. metrics (CPU, Disk, Memory, Network) using the command-line as well as GUIs. MySQL Server’s status variables are covered, with a link to the online documentation. It explains two investigation methods – USE and RED. MySQL Monitoring Tools are covered as well.
The ‘MySQL in the Cloud’ chapter provides many screenshots as it covers DbaaS (Database as a Service), EC2. It shows configuration options for Amazon RDS, Google Cloud SQL, and Azure SQL. It concludes with details of Percona Kubernetes Operator (Percona being the authors’ employer).
I spotted a few inconsistencies – in some MySQL examples, the row count of the result was wrong. And it said that ER diagrams depict relationship set using a labelled diamond but the book’s own examples used a rounded rectangle.
Summary. This is quite a demanding book. It is something that you can re-read time and time again and come away with something new but will have to supplement from other sources. I had to read and re-read whole chunks of this book (as a result it is now held together with tape) and it has refreshed and extended my database knowledge. A bibliography and glossary (see https://dev.mysql.com/doc/refman/8.0/en/glossary.html) would have been helpful – as would practical questions and answers at the end of some chapters. To be fair, the book has plenty of links inside it. The authors are quite keen on Brendan Gregg’s work on system performance analysis, which is a good sign.
Conclusion. If I wanted to learn about requirements analysis and database design, I would not recommend this book as its coverage of this is inconsistent and confusing. For the Ops in DevOps point of view, it seems to be useful but I am not sure I am qualified to comment further. The fact that the authors employed by Percona, a consulting etc. company that specialises on Open Source Databases must count for something. From the point of view of a software developer wanting to invoke SQL from within an application under development (the book does not choose a particular programming language), I would recommend this book.
Website: https://www.oreilly.com/library/view/learning-mysql-2nd/9781492085911/