RE: New Window Function: ROW_NUMBER_DESC() OVER() ?

Поиск
Список
Период
Сортировка
От Maiquel Grassi
Тема RE: New Window Function: ROW_NUMBER_DESC() OVER() ?
Дата
Msg-id CP4P284MB24830778F475F3C79984D676EC722@CP4P284MB2483.BRAP284.PROD.OUTLOOK.COM
обсуждение исходный текст
Ответ на Re: New Window Function: ROW_NUMBER_DESC() OVER() ?  (David Rowley <dgrowleyml@gmail.com>)
Ответы RE: New Window Function: ROW_NUMBER_DESC() OVER() ?
Список pgsql-hackers
As far as I see your proposal, you want to allow something that is
undefined to be reversed.  I don't think this is a good idea at all.
As mentioned by others, you should have ORDER BY clauses and just add
a DESC.

If you were looking for something to optimize in this rough area, then
perhaps adding some kind of "Backward WindowAgg" node (by overloading
the existing node) to allow queries such as the following to be
executed without an additional sort.

SELECT a,row_number() over (order by a desc) from t order by a;

The planner complexity is likely fairly easy to implement that. I
don't think we'd need to generate any additional Paths. We could
invent some pathkeys_contained_in_reverse() function and switch on the
Backward flag if it is.

The complexity would be in nodeWindowAgg.c... perhaps too much
complexity for it to be worthwhile and not add additional overhead to
the non-backward case.

Or, it might be easier to invent "Backward Materialize" instead and
just have the planner use on of those instead of the final sort.

David

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

Предыдущее
От: Masahiko Sawada
Дата:
Сообщение: Re: [PoC] Improve dead tuple storage for lazy vacuum
Следующее
От: Jelte Fennema-Nio
Дата:
Сообщение: Re: Add new protocol message to change GUCs for usage with future protocol-only GUCs