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

Home -> Community -> Usenet -> c.d.o.server -> Re: Specifying the type of join

Re: Specifying the type of join

From: Allen Kirby <akirby_at_att.com>
Date: 1997/01/10
Message-ID: <32D6934E.540@att.com>#1/1

Jason Byors wrote:
>
> How do you specify a left to right, and a right to left join in SQL.
> I can't seem to find it in any of the books I have looked in. Could
> you please e-mail me as well as posting to the newsgroup.
>
> Thank you,
> jb

I assume you mean how to determine which table drives the other table in a query, or which table is accessed first. I don't believe standard SQL has that syntax because logically speaking, it doesn't matter which table is queried first - the answer is always the same. The performance of the query may be drastically different, but the result is the same. So this is really a performance tuning question. I don't think that Oracle has a definite way to acheive this (I know they didn't in V6) but there are several indirect methods you could try, like changing the order of the tables in the from clause or maybe an optimizer trick. I'm sure others know the exact tricks, but you can use the EXPLAIN PLAN feature to tell which table is driving the query, then try different things until it uses the index you want. Also, wouldn't the cost-based optimizer usually pick the best table?

-- 
---
Allen Kirby			AT&T ITS Production Services
akirby_at_att.com			Alpharetta, GA.
Received on Fri Jan 10 1997 - 00:00:00 CST

Original text of this message

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