Re: Using 128-bit integers for sum, avg and statistics aggregates - Mailing list pgsql-hackers

From Andreas Karlsson
Subject Re: Using 128-bit integers for sum, avg and statistics aggregates
Date
Msg-id 55023C18.9060305@proxel.se
Whole thread Raw
In response to Re: Using 128-bit integers for sum, avg and statistics aggregates  (Peter Geoghegan <pg@heroku.com>)
Responses Re: Using 128-bit integers for sum, avg and statistics aggregates  (Peter Geoghegan <pg@heroku.com>)
List pgsql-hackers
On 03/10/2015 02:26 AM, Peter Geoghegan wrote:
> On Mon, Mar 9, 2015 at 5:37 PM, Andreas Karlsson <andreas@proxel.se> wrote:
>> int128-agg-v7.patch
>
> I see a spelling error:
>
> "+ * On platforms which support 128-bit integers some aggergates instead use a"

Fixed.

> 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.

Good idea! Do you think the rewritten comment is clear enough, or do I 
need to go into more detail?

/* * Integer data types use Numeric accumulators to share code and avoid risk * of overflow.  To speed up aggregation
128-bitinteger accumulators are * used instead where sum(X) or sum(X*X) fit into 128-bits, and there is * platform
support.* * For int2 and int4 inputs sum(X) will fit into a 64-bit accumulator, 
 
hence * we use faster special-purpose accumulator routines for SUM and AVG of * these datatypes. */

#ifdef HAVE_INT128
typedef struct Int128AggState

-- 
Andreas Karlsson



pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: Bug in point releases 9.3.6 and 9.2.10?
Next
From: Amit Kapila
Date:
Subject: Re: Parallel Seq Scan