--跟踪文件读入到表中分析 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耗时,从而明白优化点。