Top Cached SPs By Total Physical Reads (SQL 2008)

[sourcecode language=”sql”]

SELECT TOP(25) p.name AS [SP Name],qs.total_physical_reads AS [TotalPhysicalReads],

qs.total_physical_reads/qs.execution_count AS [AvgPhysicalReads], qs.execution_count,

qs.total_logical_reads,qs.total_elapsed_time, qs.total_elapsed_time/qs.execution_count

AS [avg_elapsed_time], qs.cached_time

FROM sys.procedures AS p WITH (NOLOCK)

INNER JOIN sys.dm_exec_procedure_stats AS qs WITH (NOLOCK)

ON p.[object_id] = qs.[object_id]

WHERE qs.database_id = DB_ID()

AND qs.total_physical_reads > 0

ORDER BY qs.total_physical_reads DESC, qs.total_logical_reads DESC OPTION (RECOMPILE);

[/sourcecode]

— This helps you find the most expensive cached stored procedures from a read I/O perspective

— You should look at this if you see signs of I/O pressure or of memory pressure

 Share!

 
comments powered by Disqus