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

From: Ronan Dunklau <ronan(dot)dunklau(at)aiven(dot)io>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org, David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
Subject: Re: Add proper planner support for ORDER BY / DISTINCT aggregates
Date: 2021-07-15 13:02:00
Message-ID: 2746808.Lq6AjvN2yG@aivenronan
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Le mardi 13 juillet 2021, 06:44:12 CEST David Rowley a écrit :
> I've attached the updated patches.

The approach of building a pathkey for the first order by we find, then
appending to it as needed seems sensible but I'm a bit worried about users
starting to rely on this as an optimization. Even if we don't document it,
people may start to change the order of their target lists to "force" a
specific sort on the lower nodes. How confident are we that we won't change this
or that we will be willing to break it ?

Generating all possible pathkeys and costing the resulting plans would be too
expensive, but maybe a more "stable" (and limited) approach would be fine, like
generating the pathkeys only if every ordered aggref shares the same prefix. I
don't think there would be any ambiguity here.

--
Ronan Dunklau

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ibrar Ahmed 2021-07-15 13:02:28 Re: BUG #16583: merge join on tables with different DB collation behind postgres_fdw fails
Previous Message Aleksander Alekseev 2021-07-15 13:01:15 Re: Signed vs Unsigned (take 2) (src/backend/storage/ipc/procarray.c)