My gauge of an amazing book is simple: if I’ve got a question, and I reach for the book BEFORE I search the web, then it’s an amazing book.
Several times in the last two weeks, I reached for this book first.
The Book’s Audience: Database Developers and Performance Tuners
This book is for people who:
- Spend ten hours or more a week asking themselves, “How can I make this application run faster?”
- Have the ability to change the database schema or queries
- Know T-SQL well enough to get the data results they want (but not necessarily the fastest way to get those results)
This book is not for people who:
- Ask themselves, “How can I make this server run faster?”
- Don’t have the ability to change schema or code (for example, people managing third-party apps from vendors or consultants)
Notice that neither of these categories drew a line between developer or DBA. I’ve worked with developers who knew how to query SQL Server to get the data, and their applications worked great – but just not as fast as they’d like. They’re going to love this book.
What Query Performance Tuning Means
Query performance tuning is the art of reading a query’s execution plan, figuring out why it’s not fast, and then determining the most cost-effective way to make it faster. Anybody can throw more indexes in and just hope it speeds up, but as the book illustrates, sometimes that can hurt more than help.
To do a good job, the tuner needs to know about indexing, statistics, execution plans, compilations, blocking, deadlocks, and query design issues that can force a query to perform poorly. Some of this stuff is covered in abstract terms in college classes, but for the most part, all of us – developers, DBAs, sysadmins – are pretty much unprepared to guess what’s going on inside the SQL Server engine.
When you first design and deploy an application, that’s a great thing: you don’t need to know what’s going on inside the black box. SQL Server handles a lot of load with the default settings, with pretty much any application design, before things start to creak and groan. I’ve seen people build amazingly big SQL Server applications without any knowledge of how indexes or execution plans work. True story: I walked into one shop to help with a performance problem, and the database administrator didn’t know that a table could have more than one index. For the most part, their servers were still performing within their needs – but of course, we achieved some fantastic results with some simple performance tuning. That DBA – and frankly, all of us – would have benefitted from a copy of this book.
Appropriate for Both Junior and Senior Levels
If you fall into this performance tuner target audience, regardless of your seniority level, you’re going to find this book’s price an extremely worthwhile investment. The book’s authors, Grant Fritchey and Sajal Dam, strike a great balance between bringing you up to speed versus diving into advanced concepts.
Chapter 4 on Index Analysis is a great example. It spends the first few pages bringing the beginners up to speed on what an index is and how B-trees work. Then it gradually layers on an explanation of how you would approach index design and why the width of your index matters. The explanation includes queries that prove the concepts, with screenshots of results where appropriate. The discussion ramps up to more advanced topics like covering indexes, filtered indexes, and compression.
When I talk about index tuning to groups of DBAs, the discussion inevitably turns to statistics – and sure enough, the book starts covering those a couple of chapters later. I really like the organization of this book because it progresses in the same way that I’d recommend training for a performance tuner. If you need to make an application run faster, read the book in order. Don’t be tempted to jump to, say, execution plan analysis – you’ll make poor decisions without understanding the concepts discussed earlier.
I’ve been performance tuning applications for years, trying to wring every last dollar’s worth out of my hardware to make our applications run faster, and I keep learning things as I go through this book. Normally, I try to read the entire book cover to cover before posting a review, but in this case, it’s going to be quite a while before I finish the book. I just keep reading a chapter, catching enough things I didn’t know before, and then stopping to apply that knowledge and test it out in my lab. I highly recommend it.
You can buy SQL Server 2008 Query Performance Distilled from Amazon, and there’s a Kindle version too.