Re: Query Plan Question
From: Aaron Weiker (msnews.SPAM_at_aaronweiker.com)
Date: 03/11/04
- Next message: Adam Machanic: "Re: Stored procedure overhead - baffling - database gurus"
- Previous message: Praty77: "Stored procedure overhead - baffling - database gurus"
- In reply to: Stephen Schissler: "Re: Query Plan Question"
- Next in thread: Tibor Karaszi: "Re: Query Plan Question"
- Messages sorted by: [ date ] [ thread ]
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/
- Next message: Adam Machanic: "Re: Stored procedure overhead - baffling - database gurus"
- Previous message: Praty77: "Stored procedure overhead - baffling - database gurus"
- In reply to: Stephen Schissler: "Re: Query Plan Question"
- Next in thread: Tibor Karaszi: "Re: Query Plan Question"
- Messages sorted by: [ date ] [ thread ]