How many times have you done something like this testing speed

T-SQL
1
2
3
4
5
Declare @cnt_test bigint
Declare @st datetime
Set @st = getdate()
Set @cnt_test = (Select count(*) From dbo.test_scan)
Select DateDiff(ms,@st,getdate())
Declare @cnt_test bigint
Declare @st datetime
Set @st = getdate()
Set @cnt_test = (Select count(*) From dbo.test_scan)
Select DateDiff(ms,@st,getdate())

Specifically the DateDiff() in milliseconds to see how long the execution took.

There is a nice little option in SSMS that I leave on when working on a query over time. It’s called Client Statistics. When set on you can get the same results and much more that can help you measure your performance while altering your code. The results will show the same as having the show execution plan on in SSMS as a tab in the results window. The results from client statistics will accumulate over the time you alter your query also. This is a very nice option and valuable when measuring your changes without adding code you will only have to remove. It will even give you an arrow showing in red if your execution time has gone up or green pointing down for improving

The option in SSMS 2005 can be found here

In SSMS 2008

Although the DateDiff and measuring milliseconds and nanoseconds (in 2008) is still required to pinpoint spots in your code, the client statistics measurement is really a nice added review of you query performance.