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

Home -> Community -> Mailing Lists -> Oracle-L -> FW: Join order and intermediate results

FW: Join order and intermediate results

From: Mark W. Farnham <mwf_at_rsiz.com>
Date: Fri, 1 Oct 2004 12:16:24 -0400
Message-ID: <KNEIIDHFLNJDHOOCFCDKAEBKFHAA.mwf@rsiz.com>


oops. didn't include list.

-----Original Message-----

From: Mark W. Farnham [mailto:mwf_at_rsiz.com] Sent: Friday, October 01, 2004 12:12 PM
To: SMILEYJ_at_tusc.com
Subject: RE: Join order and intermediate results

select ab.a1, ab.b1, cd.c1, dd.d1
from
(select rownum abr, a.a1, b.b1 from a,b where a.a1 = b.b1) ab, (select rownum cdr, c.c1, d.d1 from c,d where c.c1 = d.d1) cd where .....

for example, forces Oracle to produce the inline views in order to get valid values for ab.abr and cd.cbr.

Give it a whirl. I'm not sure who documented this first, but I think there is something about it on asktom.
I think it was the very first thing I tried when they created "inline views." Hmm. Maybe I tried orderby
on the inline views first. Let me know if you get different results than I expect.

mwf

-----Original Message-----

From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org]On Behalf Of Smiley John - IL Sent: Friday, October 01, 2004 11:43 AM
To: 'mwf_at_rsiz.com'; oracle-l_at_freelists.org Subject: RE: Join order and intermediate results

Sorry if I'm being dense, but how is including rownum going affect the execution plan? Example?

-----Original Message-----

From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Mark W. Farnham
Sent: Friday, October 01, 2004 10:37 AM
To: oracle-l_at_freelists.org
Subject: RE: Join order and intermediate results

Including the rownum in the inline views (or whatever we're calling them this week) is the standard trick to force what you seem to want.

-----Original Message-----

<snip>

When that didn't work and I made sure the table, index, and column stats were correct, I tried various hints for join order and join method. When that didn't work, I decided to smack Oracle in the face with the answer like this:

SELECT ...
FROM (SELECT ... FROM A, B WHERE ...) AB, (SELECT ... FROM C, D WHERE ...) CD
WHERE ... <snip>

--

http://www.freelists.org/webpage/oracle-l
--

http://www.freelists.org/webpage/oracle-l

--

http://www.freelists.org/webpage/oracle-l Received on Fri Oct 01 2004 - 11:12:40 CDT

Original text of this message

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