--跟蹤文件讀入到表中分析 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耗時,從而明確優化點。
查看本欄目