Quickest way to identify most used Stored Procedure variation in SQL Server 2005

后端 未结 4 2129
醉话见心
醉话见心 2021-02-14 23:28

I am trying to figure out if there\'s a way to identify a \"version\" of a SP that gets called the most. I have an SP that gets called with a bunch of different parameters. I kn

4条回答
  •  一整个雨季
    2021-02-14 23:57

    I like this snippet of code for pulling back and reviewing the execution stats. and the cached query plan for a given stored procedure. In Management Studio, you can click on the XML returned in the "query_plan" column to view the graphical version of the execution plan.

    SELECT qp.*,qs.*,st.text
        FROM sys.dm_exec_query_stats qs 
            CROSS APPLY sys.dm_exec_sql_text(sql_handle) st
            CROSS APPLY sys.dm_exec_query_plan(plan_handle) qp
        WHERE st.objectid= object_id('YourStoredProcedureName')
    

提交回复
热议问题