Re: Removing const-false IS NULL quals and redundant IS NOT NULL quals
Andy Fan <zhihuifan1213@163.com>
From: Andy Fan <zhihuifan1213@163.com>
To: David Rowley <dgrowleyml@gmail.com>
Cc: Richard Guo <guofenglinux@gmail.com>, Andrei Lepikhov
<a.lepikhov@postgrespro.ru>, Tom Lane <tgl@sss.pgh.pa.us>,
pgsql-hackers@lists.postgresql.org
Date: 2023-12-27T11:20:38Z
Lists: pgsql-bugs, pgsql-hackers
Hi,
David Rowley <dgrowleyml@gmail.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
Commits
-
Add better handling of redundant IS [NOT] NULL quals
- b262ad440ede 17.0 landed