From: Greg Stark <gsstark@mit.edu>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Correia, Carla <Carla.Correia@logicacmg.com>
Cc: 'pgsql-sql@postgresql.org' <pgsql-sql@postgresql.org>
Subject: Re: Complex outer joins?
Date: 26 Mar 2003 09:36:11 -0500
Message-ID: <87smtakxes.fsf@stark.dyndns.tv> (raw)
In-Reply-To: <12785.1048519090@sss.pgh.pa.us>
References: <0F232CC93A58D6119C1600B0D0799B8102338822@hamsrvmx03.logica.co.uk>
<12785.1048519090@sss.pgh.pa.us>
Tom Lane <tgl@sss.pgh.pa.us> writes:
> The SQL-standard way of writing this would presumably be either
>
> from G left join L on (G.SELID = L.SELID)
> left join C on (L.SELID = C.SELID and L.SELLEVEL = C.SELLEVEL)
I would think of it as this one.
> from G left join
> (L left join C on (L.SELID = C.SELID and L.SELLEVEL = C.SELLEVEL))
> on (G.SELID = L.SELID)
I don't see how that would be at all different.
> depending on which join you think ought to be done first. It might be
> that the results are the same in this case, but I'm not convinced of
> that. In general the results of outer joins definitely depend on join
> order.
I'm pretty sure Oracle actually builds an abstract join representation where
the two queries above would actually be represented the same way. Then decides
the order from amongst the equivalent choices based on performance decisions.
Can you show an example where the join order would affect the result set? I
can't think of any.
--
greg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: gsstark@mit.edu, tgl@sss.pgh.pa.us, Carla.Correia@logicacmg.com
Subject: Re: Complex outer joins?
In-Reply-To: <87smtakxes.fsf@stark.dyndns.tv>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox