How to find the most frequently executed procs

  • I want to know how many times each stored procedure gets executed for a given hour. I ran a trace using profiler template sqlprofilerSP_Counts and saved the trace results to a table, SP_COUNTS. I did a 'select distinct objectid from SP_COUNTS' to find the procs that were executed during the trace. How can I find out the number of times each was executed and store the sp_name and count in a table?

    thanks

  • This should do the trick

    insert Results

    select name, Count(ObjectID) as Cnt from SP_COUNTS

    inner join sysobjects on ObjectID = ID

    group by ObjectID, name

    The Results table has two columns Name and Cnt

     

     

     

  • check out http://www.hybridx.com

    SPUD

     

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

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