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).

----------------- details -------------------
TABLE U
-UID number,
-EMAIL varchar2(100),
-CLIENT_ID number

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!


-- Sincerely, Fred
Frederik Lindberg, CTO, CheetahMail


-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Frederik Lindberg
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (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).

Reply via email to