Re: join and where clause equivalent ?

From: Dmitry Tkach <dmitry(at)openratings(dot)com>
To: Nabil Sayegh <postgresql(at)e-trolley(dot)de>
Cc: pgsql-novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: join and where clause equivalent ?
Date: 2003-06-10 14:57:57
Message-ID: 3EE5F1F5.7070607@openratings.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Nabil Sayegh wrote:

>Hi all,
>
>is
>
>"SELECT * FROM a JOIN b USING (id_a)"
>
>fully equivalent to
>
>"SELECT * FROM a, b WHERE a.id_a=b.id_a" ?
>
>Which is faster ?
>
>TIA
>
>
I think, the latter form gives the optimizer more freedom in choosing
the query path.
In terms of the results, the two are equivalent, as for which is faster
depends on how much you trust the optimizer - if you know exactly why a
should be the outer table in the join, then the first form is better, if
you want to leave the decision to the optimizer, then the second from is
for you.

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Josh Berkus 2003-06-10 15:58:03 Re: Inheritance design question
Previous Message Nabil Sayegh 2003-06-10 12:08:16 join and where clause equivalent ?