Re: [SQL] Difference between these two queries ? - Mailing list pgsql-general

From Sam Mason
Subject Re: [SQL] Difference between these two queries ?
Date
Msg-id 20100606153604.GV20550@samason.me.uk
Whole thread Raw
In response to Re: [SQL] Difference between these two queries ?  ("Little, Douglas" <DOUGLAS.LITTLE@orbitz.com>)
List pgsql-general
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/

pgsql-general by date:

Previous
From: "Little, Douglas"
Date:
Subject: Re: [SQL] Difference between these two queries ?
Next
From: Nilesh Govindarajan
Date:
Subject: Re: Difference between these two queries ?