方法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】:
后兩種,未實際驗證,見諒。