Get MS Sql statement timing info

Tho most critical to a sql statement in a particular database is its query plan, another useful nugget of info is how long it actually takes to run the query from studio. You can get studio to give you this info by adding the following line above the query.

SET STATISTICS TIME ON

SELECT this, that FROM here INNER JOIN there on here.id = there.hereid

When you execute a statement with this line above, you get more info in the messages tab that will look like the following:

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

SQL Server Execution Times:
CPU time = 0 ms, elapsed time = 1 ms.

(1 row(s) affected)

SQL Server Execution Times:
CPU time = 16 ms, elapsed time = 18 ms.

More info http://msdn2.microsoft.com/en-us/library/ms190287.aspx.

Anybody know how to set it as the default whenever using Studio?


				
				

			

Leave a Reply

You must be logged in to post a comment.