Serious Error

When I wrote the book “Dissecting SQL Server Execution Plans” I knew I was going to get things wrong. Several people have pointed out things over the last couple of months. They’ve all been in the details. None of them were serious errors of fact. Andy Warren just found a huge one.

In the section on Table Hints I detail how to apply an INDEX() hint. It’s on page 123 in the electronic version or 124 of the first print version. I state that index number starts at 0 with the clustered index. That’s just flat wrong. A clustered index is always 1. A 0 indicates a heap. Other indexes will have values greater than 1. If you were to supply a 0 to the INDEX() hint, as shown in the book, it forces either a clustered index scan or a table scan. I go on to suggest that you use index names in order to be sure of the index used by your query and show that in the example. Good thing too. Hopefully people will listen more to that than the statement preceding it.

I’m not sure if I’ll get a chance to do edits prior to more print runs, but that will definately be included. Thanks Andy.

UPDATE:

I no more than let Tony Davis, my editor, know about the issue than he gets the electronic version updated. Plus, he’s at home sick. Tony, you’ve earned TWO beverages on me at the PASS Summit this year.

Please let me know what you think about this article or any questions:

This site uses Akismet to reduce spam. Learn how your comment data is processed.