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.
Best Answer
Here's what I can tell you.
Internally, they use two different ways obtaining the data;
sysprocesses
uses the "legacy" method andsys.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 forSQL Server 2014
specifically build12.00.5538
(SP2 CU3).