简体   繁体   中英

SQL Query Optimization Toad for Oracle

I am executing a query which is like

select a.col1
  ,a.col2
  ,b.col1
  ,b.col2
  ,c.col1
  ,c.col2
  ,d.col1
  ,d.col2
  ,e.col1
  ,e.col2
from table1 a,table2 b,table3 c,table4 d,table5 e
where a.col = b.col 
  and b.col = c.col 
  and a.col = e.col
  and c.col = d.col
  and d.col = e.col

This query is taking a lot of time to execute. I would like to know if there is any solution to optimize this query. I am using Toad for Oracle to execute.

Thank you in advance.

Assuming your query is written correctly, you want to be sure that each table has an index on col , the key used for the joining the tables.

That should fix your performance problems.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM