Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Query shows greater value of duration in trace than when the query is run by itself

The duration value in the sql server profiler trace shows a value larger for a query, than when I run the same query and take a look at the duration of execution for the query. Why is it so, or any other thing that I am missing out on?

like image 753
Gyanendra Singh Avatar asked Nov 05 '22 01:11

Gyanendra Singh


1 Answers

how larger? you know that in profiler the duration is stored in microseconds, right? So 1000000 means 1 second.

Besides that, you need to take into considerations other things like reuse of execution plan or even the fact that SSMS is an UI tool and may be doing something else with your query before sending it to the database, and profiler gets the statistics directly from the execution on the DB, which can explain a few seconds more on the execution

like image 98
Diego Avatar answered Nov 15 '22 14:11

Diego