Investigating the execution plans in syscacheobjects?

  • I have four identical entries in syscacheobjects for a single stored proc. All have very high usecount entries but I should like to know why there are four separate entries.

    Is there any way to get at the actual plans to find out why there are four separate entries?

  • Four entries can be generated because the value passed in with the statement prompted SQL Server to make a new execution plan.

    You can get the execution plan using following query:

    SELECT query_plan FROM sys.dm_exec_cached_plans cp CROSS APPLY sys.dm_exec_query_plan(cp.plan_handle);

    GO

    But it must still exist in cache for you to get it :). Thanks.

    [font="Arial"]---

    Mohit K. Gupta, MCITP: Database Administrator (2005), My Blog, Twitter: @SQLCAN[/url].
    Microsoft FTE - SQL Server PFE

    * Some time its the search that counts, not the finding...
    * I didn't think so, but if I was wrong, I was wrong. I'd rather do something, and make a mistake than be frightened and be doing nothing. :smooooth:[/font]

    How to ask for help .. Read Best Practices here[/url].

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply