Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Newbie: Index Usage
In article <80fc02$e8b$1_at_nnrp1.deja.com>,
mrslacker_at_my-deja.com wrote:
> I have a select statement as follows:
>
> select stuff
> from table1, table2
> where table1.x1 in (value1, value2) and
> table2.x2 (+) = table1.x2 and
> table2.x3 (+) = table1.x3;
>
> table1.x1 is indexed not primary. The query is
> doing a full table scan on table 1. If the outer
> joins are not present the index is used. Also if
> the in is not present and = value1 is used,and
> the outer joins are present it uses the index so
> a union works. Can anyone explain to me why this
> happens.
>
I noticed that on one had answered you yet so I will take a quick shot.
You might try comparing this to what you now have: where ( table1.x1 = value1
or table1.x1 = value2 )
and table2.x2 (+) = table1.x2
table2.x3 (+) = table1.x3;
The combination of items 1 and 2 should more or less answer you
question.
--
Mark D. Powell -- The only advice that counts is the advice that
you follow so follow your own advice --
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Fri Nov 12 1999 - 12:31:09 CST