Re: Remove useless GROUP BY columns considering unique index

Поиск
Список
Период
Сортировка
От David Rowley
Тема Re: Remove useless GROUP BY columns considering unique index
Дата
Msg-id CAApHDvot=SgDX5euFs-GwS+mBF-N_HES0LXyip=FxgqBaAaWWg@mail.gmail.com
обсуждение исходный текст
Ответ на Remove useless GROUP BY columns considering unique index  (Zhang Mingli <zmlpostgres@gmail.com>)
Ответы Re: Remove useless GROUP BY columns considering unique index
Список pgsql-hackers
On Fri, 29 Nov 2024 at 20:04, jian he <jian.universality@gmail.com> wrote:
> I found that unique expression index can also be used for groupby
> column removal.
> so I implemented it, aslo added two tests on it.

> what do you think?

I think it's likely just not common enough to be worthwhile, plus,
unfortunately, I don't think this optimisation is possible with what
we have today. Also, if it were possible you'd need to check the GROUP
BY expressions match the indexed expressions. You've not done that.

The reason I don't think is possible is that we have no infrastructure
that allows us to tag functions or operators so that non-null input(s)
mean non-null outputs.  We only have strict, which means null input
means null output. That's the opposite of what we'd need. It might
only be possible with a NULLS NOT DISTINCT index.

David



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