how that happen SP sql server

前端 未结 5 713
长情又很酷
长情又很酷 2021-01-28 04:29

I get something weird. i ran this sql:

SELECT   Id , GameTypeId , PlayerId , BetAmount , Profit ,
         DateAndTime
FROM     Results
WHERE    DateAndTime >         


        
5条回答
  •  有刺的猬
    2021-01-28 04:45

    If the number of estimated rows is very high, the optimizer comes to the conclusion that a full table scan might be more effective than an index seek + RID lookup.

    so, the question is why the number of estimated rows is way off?

    I'm, unfortunately, not so deep into SQL Server yet. However, I'd say that's because of the bind parameters; that can affect the cardinality estimates (estimates rows) quite a lot (at least in other databases).

提交回复
热议问题