Viewing a plan

sp_help_qplan reports on individual abstract plans. It provides three types of reports that you can specify: brief, full, and list. The brief report prints only the first 78 characters of the query and plan; use full to see the entire query and plan, or list to display only the first 20 characters of the query and plan.

This example prints the default brief report:

sp_help_qplan 588529130
 gid         hashkey     id          
 ----------- ----------- ----------- 
           8  1460604254   588529130 
 query                                                                          
 --------------------------------------------------------------- 
 select min(price) from titles                                                  
 plan                                                                           
--------------------------------------------------------------- 
 ( plan 
    ( i_scan type_price titles ) 
    ( ) 
) 
( prop titles 
    ( parallel ... 

A System Administrator or Database Owner can use sp_help_qplan to report on any plan in the database. Other users can only view the plans that they own.

sp_help_qpgroup reports on all plans in a group. For more information see “Getting information about a group”.