[sql]代码库
SELECT TOP 100 db_name(d.[database_id]) AS [数据库名],
s.[NAME] AS [存储名称],
s.[type_desc] AS [存储类型],
d.[cached_time] AS [SP添加到缓存的时间],
d.[last_execution_time] AS [上次执行SP的时间],
d.[last_elapsed_time] AS [上次执行SP所用的时间(微秒)],
d.[total_elapsed_time] AS [完成此SP的执行所用的总时间(微秒)],
d.[total_elapsed_time] / d.[execution_count] AS [平均执行时间(微秒)],
d.[execution_count] AS [自上次编译以来所执行的次数]
FROM SYS.[procedures] S
JOIN SYS.[dm_exec_procedure_stats] D ON S.[object_id] = D.[object_id]
WHERE S.NAME='SP_Name'
ORDER BY D.total_elapsed_time / D.execution_count DESC
by: 发表于:2017-09-08 09:55:06 顶(0) | 踩(0) 回复
??
回复评论