Re: Unique index prohibits partial aggregates

Поиск
Список
Период
Сортировка
От David Rowley
Тема Re: Unique index prohibits partial aggregates
Дата
Msg-id CAApHDvpuPHGBzngQY7qy4KeAAjP=OECVxq79dzA9ked7GBm3cw@mail.gmail.com
обсуждение исходный текст
Ответ на RE: Unique index prohibits partial aggregates  ("Bos, Fred" <fbos@huisman-nl.com>)
Список pgsql-general
On Wed, 29 Jun 2022 at 00:45, Bos, Fred <fbos@huisman-nl.com> wrote:
> Finally, is there a way to force postgres to do the partial hash aggregate,
> either by changing a setting or by influencing the expected amount of output
> groups for each query?

You could do something like:

ALTER TABLE bhload_nohyp_noin ALTER COLUMN t SET (n_distinct = 200);
ANALYZE bhload_nohyp_noin;

Please be aware that this may have detrimental effects if you do any
joins or group bys directly on this column.  Otherwise, providing you
don't have a unique index on that column, then it should trick the
planner into thinking there will be fewer groups than it currently
thinks there will be, which will likely result in the parallel plan
that you desire.

David



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

Предыдущее
От: "Bos, Fred"
Дата:
Сообщение: RE: Unique index prohibits partial aggregates
Следующее
От: Bryn Llewellyn
Дата:
Сообщение: User's responsibility when using a chain of "immutable" functions?