Re: Faster distinct query?

Поиск
Список
Период
Сортировка
От David Rowley
Тема Re: Faster distinct query?
Дата
Msg-id CAApHDvoWkyQxTq=aS20A_879+micPenOnPA1RWbK8kAuCe8+mA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Faster distinct query?  (Michael Lewis <mlewis@entrata.com>)
Список pgsql-general
On Thu, 23 Sept 2021 at 08:21, Michael Lewis <mlewis@entrata.com> wrote:
> select station, array_agg(distinct(channel)) as channels
> FROM(
> SELECT station,channel FROM data GROUP BY station,channel
> ) AS sub
> group by station;

Since the subquery is grouping by station, channel, then there's no
need for the DISTINCT in the aggregate function. Removing that should
remove some tuplestore overhead from the aggregate node.

David



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Faster distinct query?
Следующее
От: David Rowley
Дата:
Сообщение: Re: Faster distinct query?