1. 程式人生 > >SQL SERVER 查看sql語句性能與執行時間

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

col -- 查看 sele end style rtt span color

【方法一】

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

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