Different query plan to the same query! [closed]?

Up vote -1 down vote favorite share g+ share fb share tw.

Possible Duplicate: how that happen SP sql server hello, I get something weird. I ran this sql: SELECT Id , GameTypeId , PlayerId , BetAmount , Profit , DateAndTime FROM Results WHERE DateAndTime >= DATEADD (DAY , -1 , SYSDATETIME ()) AND DateAndTime = @d AND DateAndTime (the estimated row was 144000 r0ws) some 1 know what happend here?!?!? Sql-server database tsql query-plans link|improve this question asked Jan 13 '11 at 11:53dani72 0% accept rate.

Stackoverflow.com/questions/4679563/… – Markus Winand Jan 13 '11 at 11:56 Please don't double post – gbn Jan 13 '11 at 12:08.

Are you sure that you haven't muddle the execution plans. I would have assumed from a quick glance at the sql that the first query would require a table scan. I would attribute this to the fact that you have a calculation (DATEADD) in your where clause that would need to be evaluated on every row.

This is something to wacth out for when trying to write performant queries.

The DATEADD calculation won't be evaluated every row nor will it cause a table scan. The formula doesn't contain any references to columns. To see that this type of formula just gets evaluated once you can try create table #t (i int); INSERT INTO #t select CHECKSUM(NEWID())%2 from sys.

All_columns select i, COUNT(*) from #t group by i; select COUNT(*) from #t WHERE i=CHECKSUM(rand())%2 drop table #t – Martin Smith Jan 13 '11 at 12:23.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions