What does SQL Server Execution Times represent?

Tomas Vinter picture Tomas Vinter · Jun 22, 2010 · Viewed 7.1k times · Source

I have a query that I'm running on two equivalent databases, but hosted on separate MS SQL 2005 servers. I want to measure the time of a query on both servers, and thus tried the following:

SET STATISTICS TIME ON
GO
SELECT TOP 10000 *
  FROM table
GO
SET STATISTICS TIME OFF;
GO

And got the following result:

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

(10000 row(s) affected)

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

My question is, what does SQL Server Execution Times mean? Is it the execution of the query at the database only, or is it the execution of the query including the transport of data back to the client running SQL Server Management Studio?

Thanx in advance!

Answer

Thomas Rushton picture Thomas Rushton · Jun 22, 2010

Elapsed time = total time to run the query (including waiting for I/O)

CPU time = total CPU time.

A useful article on the subject is at http://www.sqlservercentral.com/articles/Performance+Tuning/measuringperformance/1323/