Re: Need help from Gurus: Profiler columns

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



NT007,

DATEDIFF counts boundaries, not actual interval. So, if the starttime and
endtime is inside the same second, DATEDIFF returns 0, but if the starttime
and endtime are in different seconds, then you will get a non-zero answer.

Duration is in microseconds, by the way, but you can look for equivalancies
by the following query.

SELECT TOP 100 Duration, ROUND((DATEDIFF(millisecond,StartTime,EndTime) /
1000.0),0) AS Seconds

FROM dbo.MyTraceTable
WHERE TextData IS NOT NULL
AND EventClass=10
ORDER BY Duration DESC

You will still notice that StartTime and EndTime and Duration are not quite
measuring the same thing, but they will be much closer.

RLF

"NT007" <JSNT007@xxxxxxxxx> wrote in message
news:OWhk%23wLpIHA.3408@xxxxxxxxxxxxxxxxxxxxxxx
Please help me understand "duration", "starttime", and "endtime" columns
in trace tables. The most confusing part is that the duration does not
match with starttime and endtime. I started a proviler and had results
stored in a table. Then I ran this query:

This is the query:

SELECT TOP 100 Duration,DATEDIFF(SS,StartTime,EndTime) AS Seconds
FROM dbo.MyTraceTable
WHERE TextData IS NOT NULL
AND EventClass=10
ORDER BY Duration DESC

Herer is the result:

Duration Seconds
-------------------- -----------
1602762 2
1405132 1
1326891 1
1025625 1
991591 1
871435 1
827483 0
822292 1
811629 0
790301 1
674423 1
644614 0
569360 0
561454 1
561160 0
488116 0
488042 1
487850 0
476883 0
474491 1
474374 0
454646 0
454173 1
453678 0






.



Relevant Pages

  • Re: DateDiff Null Values
    ... iif(endTime is null, null, datediff("s", startTime, endTime)) ... That assumes startTime is never null. ...
    (microsoft.public.access.queries)
  • Re: DateDiff Null Values
    ... iif(endTime is null, null, datediff("s", startTime, ... That assumes startTime is never null. ...
    (microsoft.public.access.queries)
  • Re: Need help from Gurus: Profiler columns
    ... WHERE TextData IS NOT NULL ... ORDER BY Duration DESC ... DATEDIFF counts boundaries, not actual interval. ... and endtime is inside the same second, DATEDIFF returns 0, but if the ...
    (microsoft.public.sqlserver.tools)
  • Re: Need help from Gurus: Profiler columns
    ... ORDER BY Duration DESC ... So, if the starttime ... and endtime is inside the same second, DATEDIFF returns 0, but if the ... equivalancies by the following query. ...
    (microsoft.public.sqlserver.tools)
  • Re: Counting Time overlap periods
    ... SELECT EventId, DATEDIFFAS Duration ... AS StartTime, MAX(EndTime) AS EndTime ...
    (microsoft.public.sqlserver.programming)