測試性能前,記得清理緩存
DBCC DROPCLEANBUFFERS --清除緩沖區 DBCC FREEPROCCACHE --刪除計划高速緩存中的元素
【方法一】
set statistics profile on set statistics io on set statistics time on go --sql語句 go set statistics profile off set statistics io off set statistics time off
【方法二】
declare @starttime datetime set @starttime=getdate() begin --sql語句 end select datediff(ms,@starttime,getdate())