SQL Server – Difference Between CPU and CPU_TIME

sql serversql server 2014

In MS SQL Server 2014, what is the difference between sys.dm_exec_requests.cpu_time and master.dbo.sysprocesses.cpu? I see that sometimes the two values are the same and other times the value are different. When should the values be different?

The following query retrieves both values.

SELECT 
      req.cpu_time
    , sp.cpu
FROM sys.dm_exec_requests req
JOIN master.dbo.sysprocesses sp ON req.session_id = sp.spid

Here are examples from my server.

cpu vs. cpu_time

Best Answer

Here's what I can tell you.

Internally, they use two different ways obtaining the data; sysprocesses uses the "legacy" method and sys.dm_exec_requests uses a newer method. Unless you have a very pedestrian workload these will generally not be the same.

Overall, I must agree with Aaron and not use sysprocesses as it is deprecated. Having said that, either method will get you "close enough" to troubleshoot issues and there shouldn't be such a difference that it hides or masks an issue from your troubleshooting efforts.

Note, this was tagged as SQL2014 and thus this answer should be considered relevant only for SQL Server 2014 specifically build 12.00.5538 (SP2 CU3).