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

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: pgsql: Add better handling of redundant IS [NOT] NULL quals
Дата
Msg-id 202401231915.uwk6zrqbdvsu@alvherre.pgsql
обсуждение исходный текст
Ответы Re: pgsql: Add better handling of redundant IS [NOT] NULL quals  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: pgsql: Add better handling of redundant IS [NOT] NULL quals  (David Rowley <dgrowley@gmail.com>)
Список pgsql-hackers
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 plan in plancache?  As I recall, lack of a mechanism to invalidate
such plans was the main reason for Postgres not to have this.  One of
the motivations for adding catalogued NOT NULL constraints was precisely
to have an OID that you could use to cause plancache to invalidate such
a plan.  Does this new code add something like that?

Admittedly I didn't read the threads or the patch, just skimmed for some
clues, so I may have failed to notice it.  But in the tests you added I
don't see any ALTER TABLE DROP CONSTRAINT.


(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 invalidation would let that case to be implemented
as well.)

-- 
Álvaro Herrera        Breisgau, Deutschland  —  https://www.EnterpriseDB.com/
"Por suerte hoy explotó el califont porque si no me habría muerto
 de aburrido"  (Papelucho)



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Heikki Linnakangas
Дата:
Сообщение: Re: Refactoring backend fork+exec code
Следующее
От: Andy Fan
Дата:
Сообщение: Re: Shared detoast Datum proposal