日期:2014-05-18  浏览次数:20527 次

请教大家点小问题
如果我想查看 一条select 语句的性能要如何做呢

像是 sp_help 我可以查看表的一些信息

这方面常用的一些操作 麻烦大家都给多说一些

一起学习

谢谢

------解决方案--------------------
就是看执行时间了,数据量很大的时候 执行的挺快的性能就好啊

下面是查看脚本的开销和执行计划、执行时间
set statistics profile on 
set statistics io on 
set statistics time on 
go
/*--你的sql脚本开始*/

go 
/*--你的sql脚本结束*/
set statistics profile off 
set statistics io off 
set statistics time off



declare @d datetime
set @d=getdate()
/*你的sql脚本开始*/

/*你的sql脚本结束*/
select [语句执行花费时间(毫秒)]=datediff(ms,@d,getdate())
------解决方案--------------------
要查看性能,可以查看sql的执行计划

运行前 ctrl+L
------解决方案--------------------
ctrl+L