Book Review: SQL Server 2008 Query Performance Tuning Distilled

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

SQL Server 2008 Query Performance Tuning Distilled
SQL Server 2008 Query Performance Tuning Distilled

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.

Previous Post
Oracle buying Sun
Next Post
The Cost of Log Shipping SQL Server to Amazon S3

10 Comments. Leave new

  • Is the book extremely 2008-centric, or are the techniques described in the book useful to users of SS2005 (and, dare I say, SS2000)?

  • Zippy – that’s a great question. The vast majority of the stuff in there is still relevant to 2005 (and even 2000) but here’s the thing: when people are seriously pouring time & money into performance tuning, my first suggestion is usually to get on the current version of SQL Server. Query execution changes with the newer versions of SQL Server, and generally speaking, you’re wasting time if you’re honing execution plans in 2000 or 2005 only to redo some of that work in 2008.

    If you’re serious about clocking the fastest time around the Nürburgring, you don’t drive a car made in 2000 – or if you do, you have to put an absurd amount of money into it just to make it compete with a new car. There’s a better ROI in using current gear.

  • Wayne Fielder
    April 20, 2009 10:51 am

    Do you know of any such book for Sql 2005? I’m a Network Security Engineer that has found himself functioning as a stand in DBA as well. That’s quite a chasm of missing knowledge I need to fill somehow or other. We are a SQL 2005 shop for the foreseeable future.

  • Wayne – absolutely, check out my list of recommended books for DBAs:

  • Wayne Fielder
    April 20, 2009 11:05 am

    Excellent! I’ll have some new books in the mail by the end of the day. Hope I’m not imposing too much here but do you know of other blogs, newsgroups, etc that focus on SQL Performance and Monitoring? I’m going to need a sounding board and would like to have a variety of voices to help keep me confused. 😉

    I can find this stuff at Google but I’d rather have a recommendation from someone I have read and appreciate.

  • Yeah, I’d look at the ones SQLBatman recommended here – most of ’em talk about performance, especially the two in ResourceDB:

  • Daniel Critchley
    November 20, 2012 7:48 am

    book in the post – thanks for the recommendation 🙂


Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.