Click here to monitor SSC
Av rating:
Total votes: 16
Total comments: 2


SQL Server Execution Plans
30 June 2008


"Every day, out in the various SQL Server forums, the same types of questions come up again and again: why is this query running slow? Why isn't my index getting used? And on and on. In order to arrive at the answer you have to ask the same return question in each case: have you looked at the execution plan?" -- Grant Fritchey, Author.

Download the eBook (To download the eBook you need to be a member of Simple Talk, the download link will take you to the registration page)

Buy the printed book from Amazon

Download the Source Code

Table of Contents

  • Chapter 01: Execution Plan Basics
  • Chapter 02: Reading Graphical Execution Plans for Basic Queries
  • Chapter 03: Text and XML Execution Plans for Basic Queries
  • Chapter 04: Understanding More Complex Query Plans
  • Chapter 05: Controlling Execution Plans with Hints
  • Chapter 06: Cursor Operations
  • Chapter 07: XML in Execution Plans
  • Chapter 08: Advanced Topics

Why read this book?

Execution plans show you what's going on behind the scenes in SQL Server. They can provide you with a wealth of information on how your queries are being executed by SQL Server, including:

  • Which indexes are getting used and where no indexes are being used at all.
  • How the data is being retrieved, and joined, from the tables defined in your query.
  • How aggregations in GROUP BY queries are put together.
  • The anticipated load, and the estimated cost, that all these operations place upon the system.

All this information makes the execution plan a fairly important tool in the tool belt of database administrator, database developers, report writers, developers, and pretty much anyone who writes TSQL to access data in a SQL Server database.

Given the utility and importance of the tool, you'd think there'd be huge swathes of information devoted to this subject. To be sure, fantastic information is available from various sources, but there really isn't any one place you can go to for focused, practical information on how to use and interpret execution plans.

This is where my book comes in. My goal was to gather as much useful information on execution plans as possible into a single location, and to organize it in such as way that it provided a clear route through the subject, right from the basics of capturing plans, through their interpretation, and then on to how to use them to understand how you might optimize your SQL queries, improve your indexing strategy, and so on.

Specifically, I cover:

  • How to capture execution plans in graphical, as well as text and XML formats
  • A documented method for interpreting execution plans, so that you can create these plans from your own code and make sense of them in your own environment
  • How SQL Server represents and interprets the common SQL Server objects – indexes, views, derived tables etc – in execution plans
  • How to spot some common performance issues such as bookmark lookups or unused/missing indexes
  • How to control execution plans with hints, plans guides and so on, and why this s a double-edged sword
  • How XML code appears in execution plans
  • Advanced topics such as parallelism, forced parameterization and plan forcing.

Along the way, I tackle such topics as SQL Server internals, performance tuning, index optimization and so on. However, my focus is always on the details of the execution plan, and how these issues are manifest in these plans. If you are specifically looking for information on how to optimize SQL, or build efficient indexes, then you need a book dedicated to these topics. However, if you want to understand how these issues are interpreted within an execution plan, then this is the place for you.

Book Details

  • Paperback: 250 pages
  • Publisher: Red Gate Books


This article has been viewed 7267 times.
Grant Fritchey

Author profile: Grant Fritchey

Grant Fritchey, SQL Server MVP, works for Red Gate Software as Product Evangelist. In his time as a DBA and developer, he has worked at three failed dot–coms, a major consulting company, a global bank and an international insurance & engineering company. Grant volunteers for the Professional Association of SQL Server Users (PASS). He is the author of the books SQL Server Execution Plans (Simple-Talk) and SQL Server 2008 Query Performance Tuning Distilled (Apress). He is one of the founding officers of the Southern New England SQL Server Users Group (SNESSUG) and it’s current president. He earned the nickname “The Scary DBA.” He even has an official name plate, and displays it proudly.

Search for other articles by Grant Fritchey

Rate this article:   Avg rating: from a total of 16 votes.


Poor

OK

Good

Great

Must read
 
Have Your Say
Do you have an opinion on this article? Then add your comment below:
You must be logged in to post to this forum

Click here to log in.


Subject: excuse me
Posted by: kbh-1983 (view profile)
Posted on: Tuesday, January 19, 2010 at 2:09 AM
Message: where can i get the code?
can you give me a url?

Subject: Code
Posted by: Grant Fritchey (view profile)
Posted on: Tuesday, March 29, 2011 at 6:46 AM
Message: It's right at the top of the page, just below the title on the right. It's a link that says "Code"

 



recommended site pinvoke

PInvoke.net is a user-driven wiki which provides .NET developers with native method signatures, so they don't have to spend time writing them from scratch.




Exchange 2010 SP1 - A Practical Approach
 This update of Jaap Wessellius' popular guide to Exchange 2010 covers everything you need to know to... Read more...

Captain Biplane: Interplanetary Airman
 Simple-Talk caters for the lighter side with its publication of 'Captain Biplane: Interplanetary... Read more...

Don't Just Roll the Dice - eBook Download
 Neil Davidson has created a short handbook with the theory, practical advice and case studies, to... Read more...

Defensive Database Programming
 Inside this book, you will find dozens of practical, defensive programming techniques that will improve... Read more...

Mastering SQL Server Profiler
 Brad McGehee's "from the ground up" guide to SQL Server's most powerful performance diagnostic tool... Read more...

Exchange 2010 - A Practical Approach
 Jaap's Practical Guide to Exchange Server 2010 draws upon all that experience to deliver an easy-to-use... Read more...

Brad's Sure Guide to SQL Server Maintenance Plans
 Brad's Sure Guide to Maintenance Plans shows you how to use the Maintenance Plan Wizard and Designer to... Read more...

Inside the SQL Server Query Optimizer
 This book will take you from the fundamentals of Statistics, Cost Estimation, Index Selection, and the... Read more...

SQL Server Hardware
 SQL Server Hardware will provide the fundamental knowledge and resources you need to make intelligent... Read more...

Performance Tuning with SQL Server Dynamic Management Views
 This is the book that will de-mystify the process of using Dynamic Management Views to collect the... Read more...

Over 400,000 Microsoft professionals subscribe to the Simple-Talk technical journal. Join today, it's fast, simple, free and secure.

Join Simple Talk