Re: FETCH FIRST clause WITH TIES option

From: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>, Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
Cc: Surafel Temsgen <surafel3000(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: FETCH FIRST clause WITH TIES option
Date: 2018-11-01 10:38:46
Message-ID: 65ecc991-97aa-50a2-7131-10c8b3991c8c@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 10/31/2018 06:17 PM, Robert Haas wrote:
> On Mon, Oct 29, 2018 at 12:48 PM Andrew Gierth
> <andrew(at)tao11(dot)riddles(dot)org(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Kukushkin 2018-11-01 10:58:52 Re: Connection slots reserved for replication
Previous Message Amit Kapila 2018-11-01 10:27:00 Re: pg_promote not marked as parallel-restricted in pg_proc.dat