SQL SERVER運維腳本系列:查詢邏輯讀取最高的查詢
阿新 • • 發佈:2018-11-21
--查詢邏輯讀取最高的查詢
SELECT TOP ( 25 ) P.name AS [SP Name] , Deps.total_logical_reads AS [TotalLogicalReads] , deps.total_logical_reads / deps.execution_count AS [AvgLogicalReads] , deps.execution_count , ISNULL(deps.execution_count / DATEDIFF(Second, deps.cached_time, GETDATE()), 0) AS [Calls/Second] , deps.total_elapsed_time , deps.total_elapsed_time / deps.execution_count AS [avg_elapsed_time] , deps.cached_time FROM sys.procedures AS p INNER JOIN sys.dm_exec_procedure_stats AS deps ON p.[Object_id] = deps.[Object_id] WHERE deps.Database_id = DB_ID() ORDER BY deps.total_logical_reads DESC;
注:摘錄於《SQL server 效能優化及管理藝術》