Sql server统计查询语句消耗时间

来源:互联网 发布:北方软件学院酷课网 编辑:程序博客网 时间:2024/05/29 11:44

方法1【set statistic】:

set statistics time on
go
 xxxx
go
set statistics time off

 

方法2【getDate()】:

DECLARE @begin dateTime
DECLARE @end dateTime
SET @begin=getdate();
BEGIN
 xxxx
end
set @end=getdate();
SELECT datediff(ms,@begin,@end) as 'Elapsed Time'

方法3【设置Query-Query options】: