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: DA Morgan <damorgan_at_psoug.org>
Date: Thu, 20 Oct 2005 15:24:41 -0700
Message-ID: <1129847075.996144@yasure>


Dan wrote:
> 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

I doubt there is a generic answer to the question.

-- 
Daniel A. Morgan
http://www.psoug.org
damorgan_at_x.washington.edu
(replace x with u to respond)
Received on Thu Oct 20 2005 - 17:24:41 CDT

Original text of this message

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