Re: pgsql: Add better handling of redundant IS [NOT] NULL quals - Mailing list pgsql-hackers

From Tom Lane
Subject Re: pgsql: Add better handling of redundant IS [NOT] NULL quals
Date
Msg-id 4071562.1706038734@sss.pgh.pa.us
Whole thread Raw
In response to Re: pgsql: Add better handling of redundant IS [NOT] NULL quals  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
List pgsql-hackers
Alvaro Herrera <alvherre@alvh.no-ip.org> 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 recall, lack of a mechanism to invalidate
> such plans was the main reason for Postgres not to have this.

IIRC, we realized that that concern was bogus.  Removal of such
constraints would cause pg_attribute.attnotnull to change, leading
to a relcache invalidation on the table, forcing replan.  If anyone
tried to get rid of attnotnull or make it incompletely reliable,
then we'd have problems; but AFAIK that's not being contemplated.

            regards, tom lane



pgsql-hackers by date:

Previous
From: "Tristan Partin"
Date:
Subject: Remove pthread_is_threaded_np() checks in postmaster
Next
From: Peter Eisentraut
Date:
Subject: Re: Build versionless .so for Android