III.2.3. Using Execution Plans to Figure Out What's Happening

Execution plans are graphical representations of a query plan. You view an execution plan to determine how the query optimizer is building the query. Execution plans are often easier to view and interpret than the all-text query plans. They also provide a lot more information on the cost of a query.

To display an execution plan, perform the following steps:

  1. Launch SQL Server Management Studio (SSMS) by choosing StartAll ProgramsMicrosoft SQL Server 2008SQL Server Management Studio.

  2. On the Connect to Server screen, click Connect.

  3. Click the New Query button to open a new query window.

  4. Right-click in the query window and choose Include Actual Execution Plan.

    You can also choose Display Estimated Execution Plan from the same menu as Include Actual Execution Plan. The estimated plan displays immediately based on the Optimizer's best guesses. The actual plan appears after the query runs and shows the actual times for the query and each sub element.

  5. Enter a query into the query window.

    If you have AdventureWorks2008 installed, use the ...

Get Microsoft® SQL Server™ 2008 All-In-One Desk Reference For Dummies® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.