Re: select distinct runs slow on pg 10.6

Поиск
Список
Период
Сортировка
От Rick Otten
Тема Re: select distinct runs slow on pg 10.6
Дата
Msg-id CAMAYy4LPC1txNPDrvw8qU136hAj__0bBpVt-aYh38+jJ5POXog@mail.gmail.com
обсуждение исходный текст
Ответ на Re: select distinct runs slow on pg 10.6  (yash mehta <yash215@gmail.com>)
Список pgsql-performance

On Tue, Sep 10, 2019 at 12:53 AM yash mehta <yash215@gmail.com> wrote:
Hi Michael/Justin/Flo,

Thank you all for your assistance. As Michael said, looks like there are no more tricks left. 

On Mon, Sep 9, 2019 at 9:09 PM Michael Lewis <mlewis@entrata.com> wrote:
If you can't modify the query, then there is nothing more to be done to optimize the execution afaik. Distinct is much slower than group by in scenarios like this with many columns. You already identified the disk sort and increased work mem to get it faster by 3x. There are not any other tricks of which I am aware.

Could you put a view in between the real table and the query that does the group by ?  (since you can't change the query)
I'm wondering if the sort/processing time would be faster when that distinct is invoked if the rows are already distinct.
 

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

Предыдущее
От: yash mehta
Дата:
Сообщение: Re: select distinct runs slow on pg 10.6
Следующее
От: Merlin Moncure
Дата:
Сообщение: Re: select distinct runs slow on pg 10.6