MSSQL‎ > ‎

Top CPU Queries


drop table #tmp
go
select * into #tmp from sysprocesses
go

-- wait for a few seconds before running the next statement

select top 20
t1.cpu - t2.cpu as cpu_diff,
t1.physical_io - t2.physical_io as io_diff,
t1.*
from sysprocesses t1, #tmp t2
where t1.spid = t2.spid
and t1.login_time = t2.login_time
and t1.ecid = t2.ecid
order by cpu_diff desc go



Comments