Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XgDTU-0008Qn-Um for pgsql-performance@arkaria.postgresql.org; Mon, 20 Oct 2014 13:58:17 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XgDTU-0001Pw-F1 for pgsql-performance@arkaria.postgresql.org; Mon, 20 Oct 2014 13:58:16 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XgDTT-0001Pp-DS for pgsql-performance@postgresql.org; Mon, 20 Oct 2014 13:58:15 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XgDTP-0007Fw-Tv for pgsql-performance@postgresql.org; Mon, 20 Oct 2014 13:58:14 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id s9KDw8Vm003182; Mon, 20 Oct 2014 09:58:08 -0400 From: Tom Lane To: Laurent Martelli cc: pgsql-performance@postgresql.org Subject: Re: IS NOT NULL and LEFT JOIN In-reply-to: <5444D5FF.5070407@enercoop.org> References: <544339CA.5090202@enercoop.org> <5444D5FF.5070407@enercoop.org> Comments: In-reply-to Laurent Martelli message dated "Mon, 20 Oct 2014 11:29:35 +0200" Date: Mon, 20 Oct 2014 09:58:08 -0400 Message-ID: <3181.1413813488@sss.pgh.pa.us> X-Pg-Spam-Score: -3.3 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org Laurent Martelli 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 -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance