sys.dm_exec_procedure_stats - execution_count


  • I have a stored proc that I was trying to find out how much it's being called for performance reasons.  I looked in sys.dm_exec_procedure_stats, at the execution_count column, but this number seems extremely high for what I expected.  So, I opened up Profiler and did a trace on the same proc, but the count was significantly less than the DMV.  I see the execution_count increment without an event in Profiler.

    Does anyone know why this is?  In Books Online, the description for the the execution_count column is: "Number of times that the stored procedure has been executed since it was last compiled."  Why am I not seeing the count grow at the same rate as the events being captured by Profiler?

    Thanks in advance.

    Thursday, December 10, 2009 5:00 PM

All replies

  • Hi Jarret,

    The sys.dm_exec_procedure_stats returns aggregate performance statistics for cached stored procedures which will return number of times since the last compiled. But the execution times in the SQL profiler is the number of times after you opened SQL profiler.

    More information about sys.dm_exec_procedure_stats:

    Hope this helps.

    ChunSong Feng
    Microsoft Online Community Support

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Monday, December 14, 2009 11:14 AM
  • Hello ChunSong,

    I appreciate your reply, but I understand that the count of Profiler trace events would be less than the execution_count column from the DMV.

    What I am confused about is this...  I see the execution_count increment without an event in Profiler.  Why am I not seeing the count grow at the same rate as the events being captured by Profiler?

    For my stored proc in question, I was seeing the DMV count increment much faster than the events show up in Profiler.

    Monday, December 14, 2009 1:23 PM
  • Hi Jarret,

    Is the proc you are trying to watching is exec in a very high frequency? Is the sever a very busy server? I mean, besides the sp events, there are lots of other events generated at the same time, right? If this is the situation, I think the scenario you describe might be cause by profiler dropping some of the events.

    Profiler will start to dropping event when it can no "catch up" the event generating frequency on server side, it doing this for limit the performance impact to the server. While DMV do not have this problem. I am not sure, but I think you can try server side trace instead of profiler to see if the number of sp events are closer to that in DMV.

    Hope this will help.

    Friday, December 18, 2009 3:02 AM
  • Hi!

    Anything new about this dmv? I have the same problem, but the difference between my case and the situation Jarret has is that one of my procedure has not been called, for sure, almost a month, but the execution count rises almost every minute.

    Thursday, October 21, 2010 1:14 PM
  • I have the same issue.    We have a reporting procedure used within SSRS.   If I watch with profile I see no RPC complete on the SP and yet the number in the DMV execution_count continues to rise.   If I interactively run the report in SSRS, I see the RPC complete exactly as I would expect.   According to the current DMV data this SP that is only used in an interactive report has been executed over 56,000 times, but the report has been run only 10-15 times in that duration. 

    What is making the DMV execution_Count continue to rise?  This is making me very distrustful of this data, but it is very important data for our tuning process, but now I cannot believe the numbers any more.


    Thursday, June 30, 2016 8:32 PM
  • Jarret, have you had any further luck with this?
    Thursday, June 30, 2016 8:33 PM