From: | Peter Geoghegan <pg(at)heroku(dot)com> |
---|---|
To: | Andreas Karlsson <andreas(at)proxel(dot)se> |
Cc: | Petr Jelinek <petr(at)2ndquadrant(dot)com>, David Rowley <dgrowleyml(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Andres Freund <andres(at)2ndquadrant(dot)com> |
Subject: | Re: Using 128-bit integers for sum, avg and statistics aggregates |
Date: | 2015-03-10 01:26:11 |
Message-ID: | CAM3SWZRLRutM9mu9VRYwBC-Yrise7kCzf9jsUkGvgCs_r1heoA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Mon, Mar 9, 2015 at 5:37 PM, Andreas Karlsson <andreas(at)proxel(dot)se> wrote:
> int128-agg-v7.patch
I see a spelling error:
"+ * On platforms which support 128-bit integers some aggergates instead use a"
Other than that, the patch looks pretty good to me. You're
generalizing from the example of existing routines for
int128_to_numericvar(), and other such code in a fairly mechanical
way. The performance improvements are pretty real and tangible.
You say:
/*
* Integer data types use Numeric accumulators to share code and avoid
* risk of overflow. For int2 and int4 inputs, Numeric accumulation
* is overkill for the N and sum(X) values, but definitely not overkill
* for the sum(X*X) value. Hence, we use int2_accum and int4_accum only
* for stddev/variance --- there are faster special-purpose accumulator
* routines for SUM and AVG of these datatypes.
*
* Similarily we can, where available, use 128-bit integer accumulators
* for sum(X) for int8 and sum(X*X) for int2 and int4, but not sum(X*X)
* for int8.
*/
I think you should talk about the new thing first (just after the
extant, first sentence "Integer data types use Numeric..."). Refer to
where 128-bit integers are used and how, and only then the other stuff
(exceptions). After that, put the PolyNumAggState struct definition
and basic functions. Then int2_accum() and so on.
--
Peter Geoghegan
From | Date | Subject | |
---|---|---|---|
Next Message | Sawada Masahiko | 2015-03-10 02:43:45 | Re: Proposal : REINDEX xxx VERBOSE |
Previous Message | Haribabu Kommi | 2015-03-10 01:20:36 | Re: Parallel Seq Scan |