Re: Is postgres able to share sorts required by common partition window functions?

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Is postgres able to share sorts required by common partition window functions?
Дата
Msg-id CAKFQuwYWuVZYnX9RCrv__L_0G_WJfGg6R9iPO9d39DK8FHOuWg@mail.gmail.com
обсуждение исходный текст
Ответ на Is postgres able to share sorts required by common partition window functions?  (Sebastien Arod <sebastien.arod@gmail.com>)
Ответы Re: Is postgres able to share sorts required by common partition window functions?  (Sebastien Arod <sebastien.arod@gmail.com>)
Список pgsql-general
On Monday, July 6, 2020, Sebastien Arod <sebastien.arod@gmail.com> wrote:
I would have expected postgresql to "share" a preliminary sort on c1 that would then be useful to reduce the work on all window functions but it doesn't. 

The plan shown does share - the output of one sort goes into another.  Subsequent sorts still have to happen but they should be faster as the first field is already grouped.  Doesn’t change the plan though.
 
I even created an index on c1 hoping that postgresql would be able to use it in order to minimize the cost of the sorts but I couldn't make it use it.

Use it how?  You are still evaluating 250k groups so doing anything piece-wise seems like an expected loss compared to sequential scan.

David J.
 

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

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: Is postgres able to share sorts required by common partition window functions?
Следующее
От: Paul McGarry
Дата:
Сообщение: Efficiently advancing a sequence without risking it going backwards.