Search code examples
sqlcpuprofilertraceduration

CPU vs. Duration in SQL Server Profiler


On this article, I am reading that:

Data column Column Number Description
Duration 13 Amount of time (in milliseconds) taken by the event.
CPU 18 Amount of CPU time (in milliseconds) used by the event.

I am troubleshooting a query that's using

  • CPU: 2,650 ms
  • Duration: 733 ms

Shouldn't these numbers be somewhat closer together? How can the query use more CPU time than the entire duration of the event?

Thanks


Solution

  • What is most likely happenings is that your SQL server is splitting your SELECT statement up to run on multiple threads on your Multi-core CPU. Judging by the times returned, I would venture to guess you have a Quad-Core CPU in your server.

    For instance: If CPU1, Cpu2, and CPU3 all take 750ms and CPU4 takes 400ms, then you would have a combined total of 2650ms, but an overall duration of only 750ms.