Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rISEb-008hxo-64 for pgsql-hackers@arkaria.postgresql.org; Wed, 27 Dec 2023 11:38:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rISEZ-004iAB-Rw for pgsql-hackers@arkaria.postgresql.org; Wed, 27 Dec 2023 11:37:59 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rISEZ-004i9u-IO for pgsql-hackers@lists.postgresql.org; Wed, 27 Dec 2023 11:37:59 +0000 Received: from m12.mail.163.com ([220.181.12.198]) by magus.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rISEU-00E8XH-Ig for pgsql-hackers@lists.postgresql.org; Wed, 27 Dec 2023 11:37:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-ID:MIME-Version: Content-Type; bh=pCWbSHb884atjsG/KR/ivjNPgp+Jbt46gaHSywwvtyA=; b=lmi8KW7SDFjNi1AXS1TMj5MPa1GXrIUD5grd8dGI8v4rSJ3oW7uesStDYTlAWp DqPAXHMA1hdYZwjl9WwWnCCPf9IrUU7MHMOAg5Y+RdQkMf1YX/qx2er3Jm8qq6IH f5ZvC92L9Dzr2RAtKf8l/i/Fv9Ky3JK7i4x8qJzsDM2gI= Received: from b97369165980 (unknown [140.205.118.66]) by zwqz-smtp-mta-g3-4 (Coremail) with SMTP id _____wDnz7CGDIxlM_2NAw--.22832S3; Wed, 27 Dec 2023 19:37:43 +0800 (CST) References: <17540-7aa1855ad5ec18b4@postgresql.org> <2732256.1657163219@sss.pgh.pa.us> <2740652.1657165848@sss.pgh.pa.us> <74a806ed-3b6c-4c45-a67a-27b5f3496ae5@postgrespro.ru> User-agent: mu4e 1.10.7; emacs 29.1 From: Andy Fan To: David Rowley Cc: Richard Guo , Andrei Lepikhov , Tom Lane , pgsql-hackers@lists.postgresql.org Subject: Re: Removing const-false IS NULL quals and redundant IS NOT NULL quals Date: Wed, 27 Dec 2023 19:20:38 +0800 In-reply-to: Message-ID: <87bkabri49.fsf@163.com> MIME-Version: 1.0 Content-Type: text/plain X-CM-TRANSID: _____wDnz7CGDIxlM_2NAw--.22832S3 X-Coremail-Antispam: 1Uf129KBjvJXoWrur48ZFWUGF45AF13Gw45ZFb_yoW8Jr1Dpr 4fKFy3JanFqr48Xr4Igw10vF18Zw4kKr17Aw15XF48ZF45CFy3XryIgr18AFyUXr95K347 XF47Kr1Iq3WSy3JanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0ziWEEUUUUUU= X-Originating-IP: [140.205.118.66] X-CM-SenderInfo: x2klx3xlid0iqsrtqiywtou0bp/xtbBzwdTU2V4HBg2WwABs9 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, David Rowley writes: > > Happy to hear other people's thoughts on this patch. Otherwise, I > currently don't think the missed optimisation is a reason to block > what we've ended up with so far. > > David > > [1] https://postgr.es/m/flat/17540-7aa1855ad5ec18b4%40postgresql.org > > [2. application/x-patch; v10-0001-Reduce-NullTest-quals-to-constant-TRUE-or-FALSE.patch]... Thanks for working on this, an I just get a complaint about this missed optimisation 7 hours ago.. I also want to add notnullattnums for the UniqueKey stuff as well, by comparing your implementation with mine, I found you didn't consider the NOT NULL generated by filter. After apply your patch: create table a(a int); explain (costs off) select * from a where a > 3 and a is null; QUERY PLAN ------------------------------------- Seq Scan on a Filter: ((a IS NULL) AND (a > 3)) (2 rows) This is acutally needed by UniqueKey stuff, do you think it should be added? To save some of your time, you can check what I did in UniqueKey [1] https://www.postgresql.org/message-id/attachment/151254/v1-0001-uniquekey-on-base-relation-and-used-it-for-mark-d.patch -- Best Regards Andy Fan