博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

用SET STATISTICS TIME命令显示T-SQL语句执行时间

Posted on 2011-04-12 20:43  光照峋山  阅读(494)  评论(0)    收藏  举报

下面的示例显示服务器的执行、分析和编译时间。

USE AdventureWorks;
GO
SET STATISTICS TIME ON
GO
SELECT *
FROM Production.ProductCostHistory
WHERE StandardCost < 500.00;
GO
SET STATISTICS TIME OFF;
GO
下面是输出结果:
SQL Server parse and compile time:
CPU time
= 0 ms, elapsed time = 1 ms.
SQL Server parse
and compile time:
CPU time
= 0 ms, elapsed time = 1 ms.

(
269 row(s) affected)

SQL Server Execution Times:
CPU time
= 0 ms, elapsed time = 2 ms.
SQL Server parse
and compile time:
CPU time
= 0 ms, elapsed time = 1 ms.