On 10/31/2018 06:17 PM, Robert Haas wrote:
> On Mon, Oct 29, 2018 at 12:48 PM Andrew Gierth
> <andrew@tao11.riddles.org.uk> wrote:
>> Then FETCH FIRST N WITH TIES becomes "stop when the expression
>> rank() over (order by ...) <= N
>> is no longer true" (where the ... is the existing top level order by)
>
> Wouldn't that be wicked expensive compared to something hard-coded
> that does the same thing?
>
Not sure, but that was one of my concerns too, particularly for the
simple FETCH FIRST N WITH TIES case. But I think Andrew has a point it
would make it much easier to implement the PERCENT case.
regards
--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services