From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: Allow the built-in ordered-set aggregates to share transition st
Date: Mon, 16 Oct 2017 19:51:28 +0000
Message-ID: <E1e4BQ8-0003Xp-Rl@gemulon.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Allow the built-in ordered-set aggregates to share transition st
In-Reply-To: <E1e4BQ8-0003Xp-Rl@gemulon.postgresql.org>
References: <E1e4BQ8-0003Xp-Rl@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox