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

2024-01-22 Thread Richard Guo
On Tue, Jan 23, 2024 at 1:11 PM David Rowley wrote: > I went over this again. I did a little more work adjusting comments > and pushed it. > > Thanks for all your assistance with this, Richard. Thanks for pushing! This is really great. Thanks Richard

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

2024-01-22 Thread David Rowley
On Tue, 23 Jan 2024 at 00:11, David Rowley wrote: > I've attached v11 which updates the expected results in some newly > added regression tests. I went over this again. I did a little more work adjusting comments and pushed it. Thanks for all your assistance with this, Richard. David

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

2024-01-22 Thread David Rowley
On Mon, 22 Jan 2024 at 17:32, Peter Smith wrote: > Hi, This patch has a CF status of "Needs Review" [1], but it seems > there were CFbot test failures last time it was run [2]. I've attached v11 which updates the expected results in some newly added regression tests. No other changes. David

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

2024-01-22 Thread David Rowley
On Thu, 28 Dec 2023 at 00:38, Andy Fan wrote: > 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

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

2024-01-21 Thread Peter Smith
2024-01 Commitfest. Hi, This patch has a CF status of "Needs Review" [1], but it seems there were CFbot test failures last time it was run [2]. Please have a look and post an updated version if necessary. == [1] https://commitfest.postgresql.org/46/4459/ [2]

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

2023-12-28 Thread Andy Fan
Richard Guo writes: > > The detection of self-inconsistent restrictions already exists in > planner. > > # set constraint_exclusion to on; > SET > # explain (costs off) select * from a where a > 3 and a is null; > QUERY PLAN > -- > Result >One-Time Filter:

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

2023-12-27 Thread Richard Guo
On Wed, Dec 27, 2023 at 7:38 PM Andy Fan wrote: > 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

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

2023-12-27 Thread Andy Fan
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.

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

2023-12-07 Thread David Rowley
(Moving discussion from -bugs [1] to -hackers for more visibility.) Background: This started out as a performance fix for bug #17540 but has now extended beyond that as fixing that only requires we don't add redundant IS NOT NULL quals to Min/Max aggregate rewrites. The attached gets rid of all