September 25, 2008 at 8:03 am
Luke L (9/24/2008)
While yer testin, if you wouldn't mind running the original again with the dateadd(datediff)) bit instead of the cast(floor)) I'd be interested if that might not eliminate the difference between the computed column and the original query.thanks.
-Luke.
declare @Col1 int
select @col1 = col1
from dbo.sometable
inner join #dates
on dateadd(day, datediff(day, 0, col6), 0) = businessday;
/*
SQL Server Execution Times:
CPU time = 1751 ms, elapsed time = 954 ms.
SQL Server parse and compile time:
CPU time = 0 ms, elapsed time = 1 ms.
*/
Difference between that and the computed column is negligible, about 10 milliseconds of CPU time and 2 milliseconds run-time. Since it's not using the index, even on the persisted version of the computed column, it's got the exact same execution plan, so any difference is just precision exceeding accuracy.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
Viewing post 16 (of 15 total)
You must be logged in to reply to this topic. Login to reply