Re: Remove useless GROUP BY columns considering unique index

Поиск
Список
Период
Сортировка
От David Rowley
Тема Re: Remove useless GROUP BY columns considering unique index
Дата
Msg-id CAApHDvouQQmCqTgSH=a1MqemC6pGGD0b7XZ35pozEN0-m7yPyA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Remove useless GROUP BY columns considering unique index  (Peter Eisentraut <peter@eisentraut.org>)
Ответы Re: Remove useless GROUP BY columns considering unique index
Список pgsql-hackers
On Wed, 18 Sept 2024 at 19:28, Peter Eisentraut <peter@eisentraut.org> wrote:
>
> On 12.09.24 03:43, David Rowley wrote:
> > (Likely it could just look at pg_attribute.attnotnull instead)
>
> That won't work because you can't record dependencies on that.  (This is
> one of the reasons for cataloging not-null constraints as real constraints.)

I'm not seeing any need to record constraint dependencies for this
optimisation. It would be different for detecting functional
dependencies in a view using a unique constraint+not null constraints
for ungrouped columns, but that's not what this is. This is just a
planner optimisation. The plan can be invalidated by a relcache
invalidation, which will happen if someone does ALTER TABLE DROP NOT
NULL.

For reference, see 5b736e9cf.

David



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