I've been trying to measure the execution time of some queries executed from an application. I've been trying to use sys.dm_exec_query_stats.last_elapsed_time but I'm confused about the values that it is returning. When I execute the query
SELECT TOP 1 qs.plan_handle, qs.last_execution_time, qs.last_elapsed_time, qs.min_elapsed_time FROM sys.dm_exec_query_stats qs ORDER BY qs.last_execution_time DESC
from the ssms, it clearly executes and returns the results just as soon as the display can refresh, clearly much faster than one second. However, the values being returned for last_elapsed_time are consistently around 1700-1800 milliseconds.
What am I missing?
Here is the msdn info page on sys.dm_exec_query_stats. I'm using sql server 2012.