The times reported are in microseconds (but only accurate to the millisecond.) This, query on the first line ran for 21 seconds in the most recent execution. That fits in with the total execution time of 1:45 for the entire SP, or am I missing something?
elapsed_time value more than query execution time?
I did take query from here in order to check performance of our queries.
- Executed a SP which took execution time of 1 min 45 seconds.
- Ran the query from the link which uses the view 'sys.dm_exec_query_stats'
- Highlighted rows in the screenshots are from same SP.
- Found that the elapsed time for those query parts of the SP taking time more than the execution time of the SP.
Am I missing any understanding? Please help me understand the functioning of the view. - Thanks in advance.
1 additional answer
Sort by: Most helpful
-
LiHongMSFT-4306 28,041 Reputation points
2024-06-21T02:52:04.8833333+00:00 As explained in the article you post, the
last_elapsed_time
column shows how long it took to execute the most recent request in microseconds. Thelast_worker_time
column indicates how long the task has spent doing work, excluding any time it was blocked.If the
last_worker_time
column is significantly lower than thelast_elapsed_time
column, this could indicate that another process is causing the query to wait before being able to run. This is known as a waiting query.Best regards,
Cosmog Hong
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".