Re: Removing const-false IS NULL quals and redundant IS NOT NULL quals

From: Andy Fan <zhihuifan1213(at)163(dot)com>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: Richard Guo <guofenglinux(at)gmail(dot)com>, Andrei Lepikhov <a(dot)lepikhov(at)postgrespro(dot)ru>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Removing const-false IS NULL quals and redundant IS NOT NULL quals
Date: 2023-12-27 11:20:38
Message-ID: 87bkabri49.fsf@163.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers


Hi,

David Rowley <dgrowleyml(at)gmail(dot)com> 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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Richard Guo 2023-12-27 11:58:26 Re: Removing const-false IS NULL quals and redundant IS NOT NULL quals
Previous Message PG Bug reporting form 2023-12-27 10:47:36 BUG #18261: Inconsistent results of SELECT affected by joined subqueries

Browse pgsql-hackers by date

  From Date Subject
Next Message Ranier Vilela 2023-12-27 11:37:25 Re: Fix Brin Private Spool Initialization (src/backend/access/brin/brin.c)
Previous Message Pavel Borisov 2023-12-27 11:18:35 Re: Bug in nbtree optimization to skip > operator comparisons (or < comparisons in backwards scans)