[COMMITTERS] pgsql: Allow the built-in ordered-set aggregates to share transitionst - Mailing list pgsql-committers

From Tom Lane
Subject [COMMITTERS] pgsql: Allow the built-in ordered-set aggregates to share transitionst
Date
Msg-id E1e4BQ8-0003Xp-Rl@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Allow the built-in ordered-set aggregates to share transition state.

The built-in OSAs all share the same transition function, so they can
share transition state as long as the final functions cooperate to not
do the sort step more than once.  To avoid running the tuplesort object
in randomAccess mode unnecessarily, add a bit of infrastructure to
nodeAgg.c to let the aggregate functions find out whether the transition
state is actually being shared or not.

This doesn't work for the hypothetical aggregates, since those inject
a hypothetical row that isn't traceable to the shared input state.
So they remain marked aggfinalmodify = 'w'.

Discussion: https://postgr.es/m/CAB4ELO5RZhOamuT9Xsf72ozbenDLLXZKSk07FiSVsuJNZB861A@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/be0ebb65f51225223421df6e10eb6e87fc8264d7

Modified Files
--------------
src/backend/executor/nodeAgg.c           |  52 +++++++++++-
src/backend/utils/adt/orderedsetaggs.c   | 133 +++++++++++++++++--------------
src/include/catalog/catversion.h         |   2 +-
src/include/catalog/pg_aggregate.h       |  14 ++--
src/include/fmgr.h                       |   1 +
src/test/regress/expected/aggregates.out |  12 ++-
src/test/regress/sql/aggregates.sql      |   8 +-
7 files changed, 149 insertions(+), 73 deletions(-)


--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: [COMMITTERS] pgsql: Repair breakage of aggregate FILTER option.
Next
From: Tom Lane
Date:
Subject: [COMMITTERS] pgsql: Treat aggregate direct arguments as per-agg data not per-transd