--跟踪文件读入到表中分析
SELECT * INTO ZGSJY
FROM fn_trace_gettable('E:\wxxcdbprofiler.trc', default);
--某时间内,最耗时SQL
select TOP 100 SUBSTRING(Textdata,1,660) as '名称',
count(*) as '数量', sum(duration/1000) as '总执行时间ms',
avg(duration/1000) as '平均执行时间ms',
avg(cpu) as '平均CPU时间ms',
avg(reads) as '平均读次数',
avg(writes) as '平均写次数'
from ZGSJY group by substring(Textdata,1,660)
order by sum(duration) desc
通过SQL Server Profiler 跟踪程序或者数据库运行过程中SQL的执行信息。然后分析sql耗时,从而明确优化点。
统计分析SQL Server Profiler 跟踪的SQL
最新推荐文章于 2023-01-09 15:55:37 发布