SqlServer performance optimization, see the CPU, large memory footprint of the session and SQL statements

1, check the CPU usage of the session and the highest amount of SQL statements
 
select spid,cmd,cpu,physical_io,memusage,
(select top 1 [text] from ::fn_get_sql(sql_handle)) sql_text
from master..sysprocesses order by cpu desc,physical_io desc
 
2, view the cache reuse fewer, large memory footprint of SQL statements
 
SELECT TOP 100 usecounts, objtype, p.size_in_bytes,[sql].[text] 
FROM sys.dm_exec_cached_plans p OUTER APPLY sys.dm_exec_sql_text (p.plan_handle) sql 
ORDER BY usecounts,p.size_in_bytes  desc
 

Guess you like

Origin www.cnblogs.com/Blue-ZXL/p/11933134.html