Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oB7ia-0006HI-KX for pgsql-bugs@arkaria.postgresql.org; Tue, 12 Jul 2022 04:41:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oB7iZ-0003Yf-BX for pgsql-bugs@arkaria.postgresql.org; Tue, 12 Jul 2022 04:41:51 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oB7iZ-0003WW-3K for pgsql-bugs@lists.postgresql.org; Tue, 12 Jul 2022 04:41:51 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oB7iW-00066u-OB for pgsql-bugs@lists.postgresql.org; Tue, 12 Jul 2022 04:41:50 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 26C4fku21385221; Tue, 12 Jul 2022 00:41:46 -0400 From: Tom Lane To: Richard Guo cc: rpsalmi@gmail.com, PostgreSQL mailing lists Subject: Re: BUG #17545: Incorrect selectivity for IS NOT DISTINCT FROM and NULLs In-reply-to: References: <17545-a0ca4de888953169@postgresql.org> Comments: In-reply-to Richard Guo message dated "Tue, 12 Jul 2022 12:35:48 +0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1385219.1657600906.1@sss.pgh.pa.us> Date: Tue, 12 Jul 2022 00:41:46 -0400 Message-ID: <1385220.1657600906@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Richard Guo writes: > The comment in the codes has explained this behavior, as it says: > * This estimation method doesn't give the right behavior for nulls, > * but it's better than doing nothing. > So maybe this is a known issue? It's a nobodys-bothered-to-make-it-better issue. In general, PG's treatment of IS [NOT] DISTINCT FROM is pretty lame --- for example, you might wish that IS NOT DISTINCT FROM could use an index in the way that "=" can, but that's never been made to happen. regards, tom lane