Sql server统计查询语句消耗时间
方法1【set statistic 】:
set statistics time on
go
 xxxx
go
set statistics time off
--适用于第一次查找,下一次查找时,易获取缓存 导致查询时间不准确;而且 设置time查找 易受其他因素影响(如系统负载等);
--多次对比查询 建议设置 IO
set statistics IO on
go
 xxxx
go
set statistics IO off

方法2【getDate()】:
DECLARE @begin dateTime
DECLARE @end dateTime
SET @begin=getdate();
BEGIN
 xxxx
end
set @end=getdate();
SELECT datediff(ms,@begin,@end) as 'Elapsed Time'
方法3【设置Query-Query options】:
后两种,未实际验证,见谅。
 
                    
                     
                    
                 
                    
                
 
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号