Thread: [COMMITTERS] pgsql: Allow the built-in ordered-set aggregates to share transitionst
[COMMITTERS] pgsql: Allow the built-in ordered-set aggregates to share transitionst
From
Tom Lane
Date:
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