October 14, 2010 at 9:14 pm
It was a very minimal test. The table didn't have any indexes, not even a primary key. After I've added an index on the LockEndDate column, the results are more favor of the Tally solution:
create index ixTestData_LockEndDate on dbo.TestData(LockEndDate)
-----------
966881
(1 row(s) affected)
Table 'TestData'. Scan count 1, logical reads 2358, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
Table 'Worktable'. Scan count 0, logical reads 0, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
Table '#Tally______________________________________________________________________________________________________________000000000011'. Scan count 1, logical reads 20, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
SQL Server Execution Times:
CPU time = 172 ms, elapsed time = 216 ms.
SQL Server parse and compile time:
CPU time = 0 ms, elapsed time = 0 ms.
-----------
966881
(1 row(s) affected)
Table 'TestData'. Scan count 1, logical reads 2358, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
SQL Server Execution Times:
CPU time = 312 ms, elapsed time = 300 ms.
SQL Server Execution Times:
CPU time = 0 ms, elapsed time = 0 ms.
October 14, 2010 at 11:17 pm
R.P.Rozema (10/14/2010)
(tnx Jeff)
You bet. Thanks for the feedback and thanks for the code to play with. It's always nice to see when folks gen more than 10 rows of data to test with.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 2 posts - 16 through 16 (of 16 total)
You must be logged in to reply to this topic. Login to reply