Re: IS NOT NULL and LEFT JOIN

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Laurent Martelli <laurent(dot)martelli(at)enercoop(dot)org>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: IS NOT NULL and LEFT JOIN
Date: 2014-10-20 13:58:08
Message-ID: 3181.1413813488@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Laurent Martelli <laurent(dot)martelli(at)enercoop(dot)org> writes:
> Do we agree that both queries are identical ?

No, they *aren't* identical. Go consult any SQL reference. Left join
conditions don't work the way you seem to be thinking: after the join,
the RHS column might be null, rather than equal to the LHS column.

regards, tom lane

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Marco Di Cesare 2014-10-20 20:32:56 Query with large number of joins
Previous Message Laurent Martelli 2014-10-20 09:29:35 Re: IS NOT NULL and LEFT JOIN