SELECT TOP 100
a.name as [存储过程名称],
b.total_elapsed_time/b.execution_count as [单次运行时间 微秒],
b.total_elapsed_time as [总运行时间 微秒],
b.execution_count as [总运行次数]
FROM sys.procedures AS a
INNER JOIN sys.dm_exec_procedure_stats AS b ON a.[Object_id] = b.[Object_id]
WHERE b.Database_id = DB_ID() ---当前DB
ORDER BY b.total_elapsed_time/b.execution_count desc ---总运行时间/总运行次数 得到单次运行时间
SELECT TOP 100
a.name as [存储过程名称],
b.total_logical_reads/b.execution_count as [单次逻辑读次数],
b.total_logical_reads as [总逻辑读次数],
b.execution_count as [总运行次数]
FROM sys.procedures AS a
INNER JOIN sys.dm_exec_procedure_stats AS b ON a.[Object_id] = b.[Object_id]
WHERE b.Database_id = DB_ID() ---当前DB
ORDER BY b.total_logical_reads/b.execution_count desc ---总逻辑读次数/总运行次数 得到单次逻辑读次数