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

Posted on 2013-07-27 21:44  冰天雪域  阅读(218)  评论(0编辑  收藏  举报

1.

set statistics time on
go
 xxxx
go
set statistics time off

 

2.

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

 

Copyright © 2024 冰天雪域
Powered by .NET 9.0 on Kubernetes