Re: Self contradictory examining on rel's baserestrictinfo

2025-01-23 Thread Tom Lane
I wrote: > This is not a fundamental shortcoming in the system, it's just > that optimizer/util/predtest.c has not been built out very far > with respect to BooleanTest nodes. Oh ... I'd momentarily forgotten that there's already a patch in the queue to attack that: https://commitfest.postgresql.

Re: Self contradictory examining on rel's baserestrictinfo

2025-01-23 Thread Tom Lane
Robert Haas writes: > On Wed, Nov 27, 2024 at 10:28 AM ro b wrote: >> I mean why can't draw the conclusions >> like the case a>1 and a>2 which can be simplified >> to a>2 if the operator > is btree opclass. > This question has already been discussed in some detail on this email > thread. First,

Re: Self contradictory examining on rel's baserestrictinfo

2024-11-27 Thread Robert Haas
On Wed, Nov 27, 2024 at 10:28 AM ro b wrote: > I mean why can't draw the conclusions > like the case a>1 and a>2 which can be simplified > to a>2 if the operator > is btree opclass. This question has already been discussed in some detail on this email thread. First, we sometimes do detect it, as

Re: Self contradictory examining on rel's baserestrictinfo

2024-11-27 Thread ro b
hackers Subject: Re: Self contradictory examining on rel's baserestrictinfo On Wed, Nov 27, 2024 at 9:30 AM ro b wrote: > The path i committed not just test contradictory but also do the > simplification. The simplification is limited in the BTREE. > Could you interpret the case in

Re: Self contradictory examining on rel's baserestrictinfo

2024-11-27 Thread Robert Haas
On Wed, Nov 27, 2024 at 9:30 AM ro b wrote: > The path i committed not just test contradictory but also do the > simplification. The simplification is limited in the BTREE. > Could you interpret the case in a little more detail. I am not able to understand this paragraph. Regretfully, -- Robe

Re: Self contradictory examining on rel's baserestrictinfo

2024-11-27 Thread ro b
From: Robert Haas Sent: Tuesday, November 26, 2024 04:55 To: ro b Cc: pgsql-hackers Subject: Re: Self contradictory examining on rel's baserestrictinfo On Mon, Nov 25, 2024 at 3:58 AM ro b wrote: > 1. Background > A few months ago, when i read source codes of B-tree in routine &

Re: Self contradictory examining on rel's baserestrictinfo

2024-11-26 Thread Robert Haas
On Tue, Nov 26, 2024 at 12:13 PM Tom Lane wrote: > Maybe your test table was partitioned?? Ah, yes, it was. -- Robert Haas EDB: http://www.enterprisedb.com

Re: Self contradictory examining on rel's baserestrictinfo

2024-11-26 Thread Tom Lane
Robert Haas writes: > On Mon, Nov 25, 2024 at 4:39 PM Tom Lane wrote: >> ... I think Robert >> must have had constraint_exclusion = on for his examples a >> couple messages back.) > I definitely didn't change the value of that setting. It's possible I > was running on an older branch, but I don

Re: Self contradictory examining on rel's baserestrictinfo

2024-11-26 Thread Robert Haas
On Mon, Nov 25, 2024 at 4:39 PM Tom Lane wrote: > BTW, it's also worth pointing out the constraint_exclusion GUC. > If that's turned up to "on" from its default setting of "partition", > it authorizes the planner to spend more effort looking for > contradictory quals. It might be reasonable to ga

Re: Self contradictory examining on rel's baserestrictinfo

2024-11-25 Thread Peter Geoghegan
On Mon, Nov 25, 2024 at 6:21 PM Tom Lane wrote: > Peter Geoghegan writes: > > I suppose that we'd have to invent some kind of new syntax for this. > > But wouldn't it also make sense if it worked with "WHERE a IN (1, 2) > > OR a IS NULL"? Or even with "WHERE a = 1 OR a IS NULL"? > > I'd be a stro

Re: Self contradictory examining on rel's baserestrictinfo

2024-11-25 Thread Tom Lane
Peter Geoghegan writes: > It would be fairly easy to teach nbtree about a new kind of > ScalarArrayOp that worked just like a conventional SAOP, but also > returned tuples matching "IS NULL" (IS NULL uses the equals strategy > internally already, so it'd be almost the same as treating NULL as > ju

Re: Self contradictory examining on rel's baserestrictinfo

2024-11-25 Thread Peter Geoghegan
On Mon, Nov 25, 2024 at 4:39 PM Tom Lane wrote: > I'm a little skeptical that we should expend a lot more effort on > the sorts of cases discussed here. Basically, this sort of patch > improves matters for people who write crummy queries while penalizing > everybody else. I think that it's more

Re: Self contradictory examining on rel's baserestrictinfo

2024-11-25 Thread Tom Lane
Peter Geoghegan writes: > On Mon, Nov 25, 2024 at 3:55 PM Robert Haas wrote: >> There are cases where we don't already draw the necessary conclusions, >> such as a>1 and a>2, which could be simplified to a>2. But those cases >> aren't necessarily that common. > Actually, we do use the more restr

Re: Self contradictory examining on rel's baserestrictinfo

2024-11-25 Thread Peter Geoghegan
On Mon, Nov 25, 2024 at 3:55 PM Robert Haas wrote: > There are cases where we don't already draw the necessary conclusions, > such as a>1 and a>2, which could be simplified to a>2. But those cases > aren't necessarily that common. Actually, we do use the more restrictive operator with cases like

Re: Self contradictory examining on rel's baserestrictinfo

2024-11-25 Thread Robert Haas
On Mon, Nov 25, 2024 at 3:58 AM ro b wrote: > 1. Background > A few months ago, when i read source codes of B-tree in routine > _bt_preprocess_keys, i found that there are more contradictory > checking case we can add. I sent email to pgsql-hackers and > then community contributor