Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Optimize SQL statement having View
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