Re: Add proper planner support for ORDER BY / DISTINCT aggregates
David Rowley <dgrowleyml@gmail.com>
From: David Rowley <dgrowleyml@gmail.com>
To: PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Date: 2021-07-12T12:04:22Z
Lists: pgsql-hackers
Attachments
- v2-0001-Add-planner-support-for-ORDER-BY-aggregates.patch (application/octet-stream) patch v2-0001
- v2-0002-WIP-Add-planner-support-for-DISTINCT-aggregates.patch (application/octet-stream) patch v2-0002
On Sun, 13 Jun 2021 at 03:07, David Rowley <dgrowleyml@gmail.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
Commits
-
Don't presort ORDER BY/DISTINCT Aggrefs with volatile functions
- da5800d5fa63 16.0 landed
-
Add enable_presorted_aggregate GUC
- 3226f47282a0 16.0 landed
-
Remove pessimistic cost penalization from Incremental Sort
- 4a29eabd1d91 16.0 landed
-
Fix hypothetical problem passing the wrong GROUP BY pathkeys
- af7d270dd3c7 16.0 landed
-
Remove unused fields from ExprEvalStep
- 9fc1776dda9f 16.0 landed
-
Improve performance of ORDER BY / DISTINCT aggregates
- 1349d2790bf4 16.0 landed
-
Refactor function parse_subscription_options.
- 8aafb0261675 15.0 cited