Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Making rule-based optimizer choose correct index
Hi,
I'm trying to do a join that is best done by a fast full scan of one index and a lookup in another. Using the rule-based optimizer and Oracle 8.1.6, I can't get the optimizer to do what I want. Is there a way? Any enlightenment would be greatly appreciated.
[Yes, we are moving to cost-based, but some applications need straightening out first).
unique index on (UID,EMAIL,CLIENT_ID)
TABLE D
-UID number
... lots of data columns
unique index on UID
Query: select D.UID,U.EMAIL from U,D where U.UID = D.UID (so in essence, I want the UID->EMAIL translation for all UID that exist in the D table).
The optimizer does a table access full on D and a range scan on the U table index. Same query with /*+ INDEX_FFS(D-index) */ results in a fast full scan of the _U_ index followed by a unique scan of the D index. Adding nonsense criteria such as "... and D.UID > 0" doesn't make things better.
The D table is very wide, so a lot of I/O is wasted by doing a full table scan.
Thanks!
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Frederik Lindberg
INET: fred_at_cheetahmail.com
Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Liststo: 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). Received on Mon Mar 04 2002 - 09:48:27 CST
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message