Book Review: High Performance MySQL (2nd Ed.)

High Performance MySQL, 2nd edition, book cover A lot has changed since the first publication of High Performance MySQL in 2004. At some point, the web turned 2.0, startups became cool again, and SQL became a bad word (regardless of how you pronounce it). For many in this new generation of web development, hand-writing SQL has become a sort of vestige--something to suffer through only as a last resort. Frameworks like Django and Ruby on Rails provide a clean abstraction to the database called an ORM, or Object-Relational Mapping, which makes it possible to develop an entire application without writing a single line of SQL. Developers end up learning the hard way that reliance on database-agnostic development can have tremendous consequences once the application has to scale to thousands or millions of users.

High Performance MySQL, by Baron Schwartz, Peter Zaitsev, Vadim Tkachenko, Jeremy Zawodny, Arjen Lentz, and Derek J. Balling, is a high-level introduction to the most powerful aspects of MySQL that's still accessible to anyone who's worked with a database before. Although this book focuses on MySQL, many of the concepts like transactions, locking, and query optimization are important to an understanding of any database system. You can get through the book on just a basic literacy of SQL, but it might be helpful to have a companion reference lying around in case something comes up.

The book starts out with a detailed overview of the MySQL architecture, with careful attention to MySQL's selection of storage engines, which offers a lot of flexibility in how you can optimize performance. As a way to explain the differences between each of these storage engines and when it might make sense to use InnoDB rather than MyISAM, for instance, the book provides a thorough explanation of how they implement locking and transactions.

Chapters 3 & 4 are also fairly specific to MySQL, as they explain the finer details of how it processes queries. MySQL does a fair amount of heuristics-based optimization on incoming queries depending on the nature of your data, and understanding what's going on under the hood can not only help you fix queries, but start writing better SQL. If you've ever added column indices because it seemed like the cool thing to do, or couldn't quite figure out how that simple query could be taking a few seconds, these two chapters especially will set you straight.

The rest of the book covers general best practices for optimizing server performance. These chapters provide a good reference for how MySQL best implements practices like benchmarking, load balancing, backups, and hardware scaling. Since most of these optimizations are external to MySQL itself, much of the information is important for any production environment.

Without a doubt, High Performance MySQL belongs on any serious developer's bookshelf. Like the original, it's an enjoyable, engaging read that provides battled-tested solutions to real-world problems that engineers face in scaling their applications. The second edition covers the new features of MySQL 5, including stored procedures, cursors, triggers and views, as well as a deeper comparative look into the various storage engines. Perhaps more importantly, the second edition brings with it a reminder of how important database design is to web development.

Mattt Thompson
Technology Evangelist Intern


This review is especially timely, as yesterday was Jeremy Zawodny's last day at Yahoo!. Jeremy hired me on as an intern this summer, and I've had the pleasure of working with him over the past few weeks. Anyway, I thought this would be a cool way to send him off. From all of us at the YDN, we wish you the best.