What interval does SQL Server Profiler's "duration" refer to?
6
votes
2
answers
2922
views
I've been having strange things on a production server. Clients (all on the local LAN) are getting *timeout* errors on queries that should have no problem at all.
- it happens during times of low CPU usage ( What does **duration** mean?
Of course that's trivial to answer:
> duration is **EndTime - StartTime**.
Which means I'm actually asking (without being pedantic):
- during what stage of query execution is **StartTime** timestamp recorded?
- during what stage of query execution is **EndTime** timestamp recorded?
If I can get an answer to that, my question next will be to find all events that go in between.
Bonus Chatter
------------------
It might be helpful to see a timeline of all events during
select getdate()
:
1. Acquire Shared Database lock
2. Release Shared Database lock
3. SP:CacheMiss
4. SQL:BatchStarting
5. SQL:StmtStarting
6. SQL:StmtCompleted
7. SQL:BatchCompleted
Of course, this is just *one*, non-repeatable, random, example of queries that take an inordinate amount of time to run.
Bonus Reading
-----------
- https://dba.stackexchange.com/questions/47988/sql-server-insert-randomly-takes-10-seconds-to-complete *(closed by grumpy people)*
- [SQL Profiler CPU / duration units](https://stackoverflow.com/questions/976628/sql-profiler-cpu-duration-units) *(it's 17,000 ms)*
- View and Analyze Traces with SQL Server Profiler
Asked by Ian Boyd
(1016 rep)
Mar 1, 2017, 03:02 PM
Last activity: Apr 16, 2025, 06:34 PM
Last activity: Apr 16, 2025, 06:34 PM