Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: why ?????????
I'm going to take a guess, since I know that there is at least one
member of the list that can do better, but here goes...
Predicates (where clauses) are applied as result sets are processed. Oracle has no knowledge that the predicate will always evaluate to false. This results in a row being read, checking the predicate and rejecting the row.
Okay, gurus, please correct me if I am wrong (by the way, I'm being totally serious...)
-- Daniel W. Fink http://www.optimaldba.com IOUG-A Live! April 27 - May 1, 2003 Orlando, FL Sunday, April 27 8:30am - 4:30pm - Problem Solving with Oracle 9i SQL Thursday, May 1 1:00pm - 2:00pm - Automatic Undo Internals AK wrote:Received on Thu Apr 03 2003 - 19:58:36 CST
> If I execute a query like ,
> select count(*) from some_table where 1=2 .
> why does oracle bothers to look at tables . Since there is only one
> condition which is false .
>
> If I write a sql like
>
> select count(*)
> from some_table
> where column_a= :a
> and a is not null;
>
> it should not even go to look at table , but explain plan suggests
> that it does a index /table scan .
>
> -ak
>
>
>
>
-- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Daniel W. Fink INET: optimaldba_at_yahoo.com Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).