From: Sam Mason <sam@samason.me.uk>
To: pgsql-general@postgresql.org
Subject: Re: [SQL] Difference between these two queries ?
Date: Sun, 6 Jun 2010 16:36:04 +0100
Message-ID: <20100606153604.GV20550@samason.me.uk> (raw)
In-Reply-To: <8585BA53443004458E0BAA6134C5A7FB066731E7@EGEXCMB01.oww.root.lcl>
References: <AANLkTinkR3ZE0y1KQWC6Ztfc_w1L3O7SlY7-y8p3X65V@mail.gmail.com>
<8585BA53443004458E0BAA6134C5A7FB066731E7@EGEXCMB01.oww.root.lcl>
On Sun, Jun 06, 2010 at 10:15:52AM -0500, Little, Douglas wrote:
> They should generate equivalent results,
> But the difference is the constraint on bu.bid=5.
> In the 1st case it's being done after the join.
> In the 2nd case it is being done before the join.
In PG version 8.1 (?) and onwards, the query planner knows that they are
equivalent and will choose from the same types of plans. I.e. it's just
a syntax issue, do whichever you think is "prettier", the semantics are
the same.
--
Sam http://samason.me.uk/
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: sam@samason.me.uk, pgsql-general@postgresql.org
Subject: Re: [SQL] Difference between these two queries ?
In-Reply-To: <20100606153604.GV20550@samason.me.uk>
* 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