From: Phillip Couto <phillip@couto.in>
To: Vitalii Tymchyshyn <vit@tym.im>
Cc: Clailson <clailson.dba@gmail.com>
Cc: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Re: Optimization inner join
Date: Thu, 19 Jan 2017 08:46:03 -0500
Message-ID: <07fa17ae-ed3c-42bb-8a63-e24093cbac3d@mtasv.net> (raw)
In-Reply-To: <CABWW-d1VooEQB-KfD-uqQgOVs9jRO6UAtgfvzXx8nvV9UqUKDw@mail.gmail.com>
References: <7ad1128e-7fdb-9976-823c-d4abdf554fa2@gmail.com>
<497e3581-bcce-4efc-b281-6b17a93479c4@mtasv.net>
<CABWW-d1VooEQB-KfD-uqQgOVs9jRO6UAtgfvzXx8nvV9UqUKDw@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>
I apologize my statement about NULL being used to join is incorrect as both Vitalii and Gustavo have both pointed out in their respective replies.
-----------------
Phillip Couto
> On Jan 19, 2017, at 08:30, Vitalii Tymchyshyn <vit@tym.im> wrote:
>
>
> Hi.
>
> In SQL "null == any value" resolves to false, so optimizer can safely skip nulls from either side if any for the inner join.
>
> Best regards, Vitalii Tymchyshyn
>
> NULL is still a value that may be paired with a NULL in a.a
>
> The only optimization I could see is if the a.a column has NOT NULL defined while b.b does not have NOT NULL defined.
>
> Not sure if it is all that common. Curious what if you put b.b IS NOT NULL in the WHERE statement?
>
> -----------------
> Phillip Couto
>
>
>
>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: phillip@couto.in, vit@tym.im, clailson.dba@gmail.com
Subject: Re: Optimization inner join
In-Reply-To: <07fa17ae-ed3c-42bb-8a63-e24093cbac3d@mtasv.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox