Re: [SQL] Difference between these two queries ?

From: Sam Mason <sam(at)samason(dot)me(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: [SQL] Difference between these two queries ?
Date: 2010-06-06 15:36:04
Message-ID: 20100606153604.GV20550@samason.me.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

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/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Nilesh Govindarajan 2010-06-06 16:34:16 Re: Difference between these two queries ?
Previous Message Little, Douglas 2010-06-06 15:15:52 Re: [SQL] Difference between these two queries ?

Browse pgsql-sql by date

  From Date Subject
Next Message Nilesh Govindarajan 2010-06-06 16:34:16 Re: Difference between these two queries ?
Previous Message Little, Douglas 2010-06-06 15:15:52 Re: [SQL] Difference between these two queries ?