General information
Title:
How to speed up query
Hi,
I try to run the following query on oracle: (all the columns used in WHERE clause are already indexed)
SELECT Tab1.*, Tab2.*, Tab3.*, Tab4.*, Tab5.* FROM tab1, tab2, tab3, tab4, tab5 WHERE (tab1.column1=tab5.column1) AND (tab1.column2=tab2.column2) AND (tab2.column3=tab4.column3) AND (tab2.column4=tab3.column4)
AND tab1.column5=to_date('1900-01-01','YYYY-MM-DD')
AND tab2.column6='03' AND tab2.column7='AC';
It takes 20 minutes. But if I run the following:
SELECT Tab1.*, Tab2.*, Tab3.*, Tab4.*, Tab5.* FROM tab1, tab2, tab3, tab4, tab5 WHERE (tab1.column1=tab5.column1) AND (tab1.column2=tab2.column2) AND (tab2.column3=tab4.column3) AND (tab2.column4=tab3.column4)
AND tab1.column5=to_date('1900-01-01','YYYY-MM-DD');
It takes 15 seconds. And also the following take the same 15 seconds:
SELECT Tab1.*, Tab2.*, Tab3.*, Tab4.*, Tab5.* FROM tab1, tab2, tab3, tab4, tab5 WHERE (tab1.column1=tab5.column1) AND (tab1.column2=tab2.column2) AND (tab2.column3=tab4.column3) AND (tab2.column4=tab3.column4)
AND tab2.column6='03' AND tab2.column7='AC';
Is sth wrong with the first query?
Thanks a lot.
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only