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

Home -> Community -> Usenet -> c.d.o.server -> Optimize SQL statement having View

Optimize SQL statement having View

From: peter <wu0020_at_home.com>
Date: Fri, 17 Dec 1999 16:49:55 GMT
Message-ID: <TQt64.6091$ZT5.3340688@news1.rdc1.on.wave.home.com>


Hi,

    I have trouble to optimize a SQL statement having view in it.

for example:

create view testview as select t1.col1 view_col1 , t2.col5 from t1 , t2 where t1.col1=t2.col2 ;

create index index1 on t1(col1);

Now, if I issue the following command:

    select * from testview where view_col1=1234;     select t1.col1 view_col1, t2.col5 from t1, t2 where t1.col1=t2.col2 and view_col1=1234;

this first statement will run very slow( full table scan), and it does not use index1 on t1.col1. Second one is fast.

How can I do to make it using index1 first? Received on Fri Dec 17 1999 - 10:49:55 CST

Original text of this message

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