RE: New Window Function: ROW_NUMBER_DESC() OVER() ? - Mailing list pgsql-hackers

From Maiquel Grassi
Subject RE: New Window Function: ROW_NUMBER_DESC() OVER() ?
Date
Msg-id CP4P284MB2483032E6B4B5A10DE5EC731EC722@CP4P284MB2483.BRAP284.PROD.OUTLOOK.COM
Whole thread Raw
In response to RE: New Window Function: ROW_NUMBER_DESC() OVER() ?  (Maiquel Grassi <grassi@hotmail.com.br>)
Responses Re: New Window Function: ROW_NUMBER_DESC() OVER() ?
List 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.

  • Okay, now I'm convinced of that.

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;

  • David, considering this optimization, allowing for that, do you believe it is plausible to try advancing towards a possible Proof of Concept (PoC) implementation?

Maiquel.

pgsql-hackers by date:

Previous
From: Jelte Fennema-Nio
Date:
Subject: Re: Add new protocol message to change GUCs for usage with future protocol-only GUCs
Next
From: Bharath Rupireddy
Date:
Subject: Re: introduce dynamic shared memory registry