From: Heikki Linnakangas <heikki.linnakangas@iki.fi>
To: pgsql-committers@postgresql.org
Subject: pgsql: Speed up SUM calculation in numeric aggregates.
Date: Fri, 02 Sep 2016 08:52:10 +0000
Message-ID: <E1bfkCo-0007lJ-3k@gemulon.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>
Speed up SUM calculation in numeric aggregates.
This introduces a numeric sum accumulator, which performs better than
repeatedly calling add_var(). The performance comes from using wider digits
and delaying carry propagation, tallying positive and negative values
separately, and avoiding a round of palloc/pfree on every value. This
speeds up SUM(), as well as other standard aggregates like AVG() and
STDDEV() that also calculate a sum internally.
Reviewed-by: Andrey Borodin
Discussion: <c0545351-a467-5b76-6d46-4840d1ea8aa4@iki.fi>
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/9cca11c915e458323d0e746c68203f2c11da0302
Modified Files
--------------
src/backend/utils/adt/numeric.c | 601 ++++++++++++++++++++++++++++------
src/test/regress/expected/numeric.out | 16 +
src/test/regress/sql/numeric.sql | 8 +
3 files changed, 522 insertions(+), 103 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: heikki.linnakangas@iki.fi
Subject: Re: pgsql: Speed up SUM calculation in numeric aggregates.
In-Reply-To: <E1bfkCo-0007lJ-3k@gemulon.postgresql.org>
References: <E1bfkCo-0007lJ-3k@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