Re: Add proper planner support for ORDER BY / DISTINCT aggregates

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Add proper planner support for ORDER BY / DISTINCT aggregates
Date: 2021-07-12 12:04:22
Message-ID: CAApHDvpz7_GmEPq=OHaXNrAX1mcDB2y+scYEBT5+seabvU-m4w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, 13 Jun 2021 at 03:07, David Rowley <dgrowleyml(at)gmail(dot)com> wrote:
>
> Please find attached my WIP patch. It's WIP due to what I mentioned
> in the above paragraph and also because I've not bothered to add JIT
> support for the new expression evaluation steps.

I've split this patch into two parts.

0001 Adds planner support for ORDER BY aggregates.

0002 is a WIP patch for DISTINCT support. This still lacks JIT
support and I'm still not certain of the best where to store the
previous value or tuple to determine if the current one is distinct
from it.

The 0001 patch is fairly simple and does not require much in the way
of changes in the planner aside from standard_qp_callback().
Surprisingly the executor does not need a great deal of work here
either. It's just mostly about skipping the normal agg(.. ORDER BY)
code when the Aggref is presorted.

David

Attachment Content-Type Size
v2-0001-Add-planner-support-for-ORDER-BY-aggregates.patch application/octet-stream 14.4 KB
v2-0002-WIP-Add-planner-support-for-DISTINCT-aggregates.patch application/octet-stream 17.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Laurenz Albe 2021-07-12 12:06:31 Re: [PATCH] improve the pg_upgrade error message
Previous Message Ibrar Ahmed 2021-07-12 11:59:41 2021-07 CF now in progress