Re: pgsql: Add better handling of redundant IS [NOT] NULL quals

2024-01-23 Thread David Rowley
On Wed, 24 Jan 2024 at 08:15, Alvaro Herrera wrote: > (Similarly, allowing GROUP BY to ignore columns not in the GROUP BY, > when a UNIQUE constraint exists and all columns are NOT NULL; currently > we allow that for PRIMARY KEY, but if you have the NOT NULL constraint > OIDs to cue the plan inval

Re: pgsql: Add better handling of redundant IS [NOT] NULL quals

2024-01-23 Thread Tom Lane
Alvaro Herrera writes: > On 2024-Jan-23, David Rowley wrote: >> Until now PostgreSQL has not been very smart about optimizing away IS >> NOT NULL base quals on columns defined as NOT NULL. > Hmm, what happens if a NOT NULL constraint is dropped and you have such > a plan in plancache? As I recal

Re: pgsql: Add better handling of redundant IS [NOT] NULL quals

2024-01-23 Thread Alvaro Herrera
On 2024-Jan-23, David Rowley wrote: > Add better handling of redundant IS [NOT] NULL quals > > Until now PostgreSQL has not been very smart about optimizing away IS > NOT NULL base quals on columns defined as NOT NULL. Hmm, what happens if a NOT NULL constraint is dropped and you have such a pla