Re: Outer join with where conditions

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Michał Otroszczenko <michal(dot)otroszczenko(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Outer join with where conditions
Date: 2005-11-14 16:29:20
Message-ID: 20051114162920.GA27026@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Nov 14, 2005 at 14:45:22 +0100,
Michał Otroszczenko <michal(dot)otroszczenko(at)gmail(dot)com> wrote:
> Hello,
>
> I wonder If I could move additional join condition from ON part of
> query to where part.

Yes, but the semantics are different for outer joins.

>
> For example instead of:
>
> SELECT * FROM
> booking_load AS bload
> LEFT OUTER JOIN dict_load_type_tsl AS load_tsl ON (
> load_tsl.dict_load_type_id = bload.dict_load_type_id
> AND load_tsl.dict_language_id = 'EN' ))
>
> Could I write:
>
> SELECT * FROM
> booking_load AS bload
> LEFT OUTER JOIN dict_load_type_tsl AS load_tsl USING (dict_load_type_id)
> WHERE
> load_tsl.dict_language_id = 'EN'
>
> I thought that second query could be more 'optimizable', but gave no results.
> Where is the problem ?
>
> Best regards,
> Michal
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Michał Otroszczenko 2005-11-14 16:58:48 Re: Outer join with where conditions
Previous Message Teodor Sigaev 2005-11-14 16:17:48 Re: Fuzzy text search