Re: Query Plan Question

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Aaron Weiker (msnews.SPAM_at_aaronweiker.com)
Date: 03/11/04


Date: Thu, 11 Mar 2004 13:04:06 -0500

Stephen Schissler wrote:

> It guesses?
>
> So if I have 1 record of 10 million where the AddedOn date is equal to '2004-03-10' and I pass this value as a variable it will do a table scan? That seems to me to be the wrong thing to do. I've updated the statistics on the AddedOn date field using the FULLSCAN option and it still does a table scan which I find very disturbing. I'm now wondering how many other queries that use variables as a parameter are choosing the wrong query plan due to this.
>
> Thanks,
> Stephen
>

If you run it as a stored procedure and use the where clause as a
parameter you will notice different results.

-- 
Aaron Weiker
http://blogs.sqladvice.com/aweiker
http://aaronweiker.com/