1234567

Every day, out in the various online forums devoted to SQL Server, and on Twitter, the same types of questions come up repeatedly: Why is this query running slowly? Why is SQL Server ignoring my index? Why does this query run quickly sometimes and slowly at others?

My response is the same in each case: have you looked at the execution plan? An execution plan describes what's going on behind the scenes when SQL Server executes a query. It shows how the query optimizer joined the data from the various tables defined in the query, which indexes it used, if any, how it performed any aggregations or sorting, and much more. It also estimates the cost of all of these operations, in terms of the relative load placed on the system. Every Database Administrator, developer, report writer, and anyone else who writes T-SQL to access SQL Server data, must understand how to read and interpret execution plans.

SQL Server Execution Plans leads you right from the basics of capturing plans, through how to interrupt them in their various forms, graphical or XML, and then how to use the information you find there to diagnose the most common causes of poor query performance, and so optimize your SQL queries, and improve your indexing strategy.

Grant Fritchey

Grant Fritchey works as a development database administrator for FM Global, an industry-leading engineering and insurance company. In his previous time as a database administrator and developer, he has worked at three failed dot-coms, a major consulting company, and a global bank. He has developed large-scale applications in languages such as VB, C#, and Java and has lived with SQL Server from the hoary days of 6.0, right through to 2008. His nickname at work is "The Scary DBA." He even has an official name plate, and he displays it proudly. Grant volunteers for the Professional Association of SQL Server Users (PASS) and has written and published articles on various topics relating to SQL Server at Simple-Talk, SQL Server Central, SQL Server Performance, the PASS web site, SQL Standard, and the SQL Server Worldwide Users Group. He is the author of the book emDissecting SQL Server Execution Plans/em. He is one of the founding officers of the Southern New England SQL Server Users Group (SNESSUG). Outside work, Grant kayaks, learns and teaches self-defense, brews his own beer, chops wood to heat his house, raises his kids, and helps lead a pack of Cub Scouts.

Chapter 1: Execution Plan Basics

Chapter 2: Graphical Execution Plans for Basic Queries

Chapter 3: Text and XML Execution Plans for Basic Queries

Chapter 4: Understanding More Complex Query Plans

Chapter 5: Controlling Execution Plans with Hints

Chapter 6: Cursor Operations

Chapter 7: Special Datatypes and Execution Plans

Chapter 8: Advanced Topics