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

Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL Tuning question

Re: SQL Tuning question

From: Dan <daniel.ostertag_at_visaer.com>
Date: 20 Oct 2005 13:15:12 -0700
Message-ID: <1129839312.539906.295010@g44g2000cwa.googlegroups.com>


Another question. I'm trying to find out the most efficient way to join multiple tables. Take a situation in which you are joining multiple tables on the same field. Is it better to join table1 to table2 then table2 to table3 like below:

select TABLE1.partno from TABLE1, TABLE2, TABLE3   where table1.partno = table2.partno and

           table2.partno = table3.partno;

Or is it better to join all from the table1 field, like below: select TABLE1.partno from TABLE1, TABLE2, TABLE3   where table1.partno = table2.partno and

           table1.partno = table3.partno;

I did a quick explain plan and scenario #2 showed a lower cost but I don't know if that's because of my data or not. I saw a book example which used scenario #1. Can I make a hard and fast rule on this type of thing, or does it depend on the data, the driving table, etc?

Thanks,
Dan Received on Thu Oct 20 2005 - 15:15:12 CDT

Original text of this message

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