SQLTeam.com | Weblogs | Forums

Total_Elapsed_Time in dm_exec_requests appears incorrect


#1

While creating a stored proc to detect long running processes I noticed total_elapsed_time from dm_exec_requests was reporting incorrect times when update statistics is running. It may be doing this for other processes as well, but this is one I am able to replicate consistently. It starts out reporting the correct elapsed time, but quickly the reported time becomes more than double the actual elapsed time. Has anyone noticed this behavior? I can't find any documented bugs.

Thanks, Dave


#2

You mean reported CPU time? What if the update is running in parallel on, say 16 cpus? I'd expect the CPU time to add up to more than the elapsed


#3

Is that CPU time? BOL says "Total time elapsed in milliseconds since the request arrived. Is not nullable". I took that to mean elapsed query time


#4

OK -- so how are you getting the actual elapsed time? like, from you watch or something?


#5

If I run the following command and hit enter constantly I eventually see the time jump beyond the actual execution time. Execution time is taken from my PC.

Select total_elapsed_time ,
total_elapsed_time as total_elapsed_time,
total_elapsed_time/1000 as total_elapsed_time_Sec,
total_elapsed_time/1000/60 as total_elapsed_time_Min
From sys.dm_exec_requests


#6

Sorry. I had one too many columns in the query. Below is a sample of what I am running.

Select total_elapsed_time ,
total_elapsed_time/1000 as total_elapsed_time_Sec,
total_elapsed_time/1000/60 as total_elapsed_time_Min
From sys.dm_exec_requests