SQL SERVER 查看sql語句性能與執行時間


測試性能前,記得清理緩存

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())

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM