views:

14

answers:

1

Hi,

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!

+1  A: 

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/

Thomas Rushton
As I understand the article, I/O means reading to/from disk and/or memory. That is, not including transport of data over tcp/ip. Does this sound correct?
Clean
Sounds about right to me. However, you also may need to take into account any parallel processing. But it's most likely to be disk I/O. There's an interesting discussion on the SSC forums: http://www.sql-server-performance.com/faq/cpu_elapsed_time_query_performance_p1.aspx
Thomas Rushton