SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Troubleshooting Performance - Top CPU Queries

Today I came accross white paper "Troubleshooting Performance Problems in SQL Server" by Sunil Agarwal, Boris Baryshnikov, Tom Davidson, Keith Elmore, Denzil Ribeiro, Juergen Thomas 
in the MSDN site after reading through i thought i can mention couple of TSQL queries in the whitepaper for CPU issues which can be useful,
1. Top 50 Query contributing using most CPU,The query aggregates the CPU consumed by all statements with the same plan__handle
select top 50
    sum(qs.total_worker_time) as total_cpu_time,
    sum(qs.execution_count) as total_execution_count,
    count(*) as  number_of_statements,
    sys.dm_exec_query_stats qs
group by qs.plan_handle
order by sum(qs.total_worker_time) desc
2. TOP 25 stored procedures that have been recompiled,
select *
from sys.dm_exec_query_optimizer_info
select top 25
    sys.dm_exec_query_stats a
    cross apply sys.dm_exec_sql_text(sql_handle) as sql_text
    plan_generation_num >1
order by plan_generation_num desc


Vinoth is currently a Senior SQL Server DBA and 10 years of experience as SQL Server DBA. Started my career as a DBA in SQL 6.5/7 has worked in all subsequent SQL Server version. Vinoth has worked in some of the largest SQL server environments in the world in various domains ranging from Finance, Retail, Manufacturing, Consulting, Web etc. Vinoth has Engineering Degree in Computer Science and has certified in MCITP - Database Adminstrator in 2008/2005, MCDBA and ITIL Foundation V3.


Leave a comment on the original post [www.sqltechnet.com, opens in a new window]

Loading comments...