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 < SYSDATETIME ()
ORDER BY DateAndTime ASC;
i have noncluster index on the date column and the actual number of rows that return is 672 row from 1600016 rows in the table. (the estimated row was 1)
after that i ran this sql:
declare @d DATETIME2(7)
set @d = DATEADD (DAY , -1 , SYSDATETIME ())
declare @d2 DATETIME2(7)
set @d2 = SYSDATETIME ()
SELECT Id , GameTypeId , PlayerId , BetAmount , Profit ,
DateAndTime FROM Results
WHERE DateAndTime >= @d
AND
DateAndTime < @d2
ORDER BY DateAndTime ASC;
and the actual execution plan was TABLE SCANE !!! and the actual number of rows that return is 672 row from 1600016 rows in the table. (the estimated row was 144000 r0ws)
some 1 know what happend here ?!?!?