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

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

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

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.