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