Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: View merging

RE: View merging

From: Djordje Jankovic <djankovic_at_corp.attcanada.ca>
Date: Tue, 23 Jan 2001 12:19:50 -0500
Message-Id: <10750.127294@fatcity.com>


Thanks Lisa and others,  

I figured it out. The view has in its list of fields (don't ask me why) the "rownum" field. I know that this does not make any sense, but anyway. Btw, while digging through docs I found that if one has any type of set function
(group function, distinct, ...) in the view definition it will not merge the
query condition with the view definition.  

Djordje

-----Original Message-----
From: Koivu, Lisa [mailto:lkoivu_at_qode.com] Sent: Tuesday, January 23, 2001 11:42 AM To: Multiple recipients of list ORACLE-L Subject: RE: View merging

Have you tried writing another view with all the joins in it? Put the index hint in the view and it should work.

Views can screw up the optimizer. This is one case.

-----Original Message-----
From: Djordje Jankovic [ mailto:djankovic_at_corp.attcanada.ca <mailto:djankovic_at_corp.attcanada.ca> ]
Sent: Tuesday, January 23, 2001 10:56 AM To: Multiple recipients of list ORACLE-L Subject: View merging

Hi everybody,

I have a weird problem. A query does not want to merge a where clause with the view (as far as I know this should be default behavior).

So, I have something like

create view xxxx as

   select table_a.field1, table_a.field_c, table_b.field2 
     from table_a, table_b 
    where table_a.field_a = table_b.field_b; 

When I run the query against the view:

select *
  from xxxx
 where field_c = 'aaa';

where field_c is an indexed field from table_a, oracle does not use the index.

However when I run (add the where clause to the view defining query):

select table_a.field1, table_b.field2 
  from table_a, table_b 
 where table_a.field_a = table_b.field_b 
   and table_a.field_c = 'aaa'; 

The index is used.

I tried both COST and RULE optimizer, tried giving hints (including the /*+ MERGE */ ) but nothing helped.

Any ideas, suggestions ?

Thanks.

Djordje

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
<http://www.orafaq.com>  
-- 
Author: Djordje Jankovic 
  INET: djankovic_at_corp.attcanada.ca 

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: 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
Received on Tue Jan 23 2001 - 11:19:50 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US