Trace Duration in -ve

  • Will the SQL server profiler trace duration value will be in -ve?

    here is the one i got

    Duration Starttime Endtime

    -432014-05-06 22:26:07.8872014-05-06 22:26:07.843

    how it is possible??

  • What do you mean by "-ve"?

    And you're right, a negative duration is not really possible. The actual capture of trace events is in microseconds and the GUI in Profiler displays in milliseconds. I have seen that conversion lead to problems. You can change the Profiler GUI to work with microseconds in the options.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • -ve --> negative.I got the negative value in one of my statement.

    If you see the duration which i have provided is in milliseconds and thats too 43 millisecond.

  • So, it's probably a rounding error. The capture of events in trace is in microseconds. Your display is milliseconds.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Probably a rounding error.

    Could also be server synching time with domain controller, if this happened between start and end of trace.

  • Grant Fritchey (5/7/2014)


    So, it's probably a rounding error. The capture of events in trace is in microseconds. Your display is milliseconds.

    Then how to rely on it ?

  • SQL doesn't use high-precision timers (too resource intensive). Inaccuracy in the order of a few ms is not a problem. Like most rounding issues, the large numbers are accurate enough and a couple ms here or there is not going to skew performance tests, because you should take multiple tests and average.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Everything Gail said, plus, remember it does capture the values in microseconds. Just change the display to use those instead of milliseconds and you'll see fewer issues.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply