question

manjunathnarayani avatar image
manjunathnarayani asked

SQl DBA - No rows in sys.dm_exec_procedure_stats for particluar Stored procedure

I am running DMV queries to get stats for my Stored procedure , but I am not finding any rows against this SP under sys.dm_exec_procedure_stats.Please suggest what could be various reason for this as I can see my stored procedure has been executed multiple times. SQl server version: 2012
sql server 2012
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Tom Staab avatar image
Tom Staab answered
My suspicion was that the procedure might have been recompiled, but I wanted to test my theory before responding. I just confirmed that executing "sp_recompile" or specifying "WITH RECOMPILE" in the procedure definition will cause that DMV to not include results for that procedure. The reason for this is explained in the [MSDN][1] article for the DMV: > The view returns one row for each cached stored procedure plan, and the lifetime of the row is as long as the stored procedure remains cached. When a stored procedure is removed from the cache, the corresponding row is eliminated from this view. Is it possible one of those 2 events is happening in your environment? [1]: https://msdn.microsoft.com/en-us/library/cc280701.aspx
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.