sql-servert-sqldatabase-performancedatabase-administrationdatabase-tuning

Performance issue - max_elapsed_time


I have an sp running in production with max_elapsed_time = 87269.399 and avg_elapsed_time (ms) = 10.24. Also max_logical_reads : 8180303 avg_logical_read = 3803.83795958974

Can anyone please help to understand why we have these much times difference in max time and average time. what all could be the reasons.


Solution

  • Without any more information, my coin-flip answer (e.g., I'm guessing a 50% chance of being correct) is parameter sniffing.

    Here's an excellent hour-long video by Brent Ozar on identifying and approaches to fixes.


    Edit: Of course, there are myriad other possibilities.

    On the other hand, most people will be able to find and fix (or at least understand) a lot of the above when reviewing the stored procedure. However, if you haven't heard of parameter sniffing, then it's unlikely you'd be able to discover it yourself.