From: | Heikki Linnakangas <hlinnakangas(at)vmware(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Andres Freund <andres(at)2ndquadrant(dot)com>, Arthur Silva <arthurprs(at)gmail(dot)com>, Andreas Karlsson <andreas(at)proxel(dot)se>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: [WIP Patch] Using 128-bit integers for sum, avg and statistics aggregates |
Date: | 2014-10-28 14:40:06 |
Message-ID: | 544FAAC6.2090602@vmware.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 10/28/2014 04:06 PM, Tom Lane wrote:
> Heikki Linnakangas <hlinnakangas(at)vmware(dot)com> writes:
>> It wouldn't be too hard to just do:
>
>> struct {
>> int64 high_bits;
>> uint64 low_bits;
>> } pg_int128;
>
>> and some macros for the + - etc. operators. It might be less work than
>> trying to deal with the portability issues of a native C datatype for this.
>
> -1. That's not that easy, especially for division, or if you want to
> worry about overflow.
The patch doesn't do division with the 128-bit integers. It only does
addition and multiplication. Those are pretty straightforward to implement.
> The point of this patch IMO is to get some low
> hanging fruit; coding our own int128 arithmetic doesn't sound like
> "low hanging" to me.
I wasn't thinking of writing a full-fledged 128-bit type, just the the
few operations needed for this patch.
> Also, we've already got the configure infrastructure for detecting
> whether a platform has working int64. It really shouldn't be much
> work to transpose that to int128 (especially if we don't care about
> printf support, which I think we don't).
It would be nicer to be able to use the same code on all platforms. With
a configure test, we'd still need a fallback implementation for
platforms that don't have it.
- Heikki
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2014-10-28 14:46:44 | Re: Directory/File Access Permissions for COPY and Generic File Access Functions |
Previous Message | Simon Riggs | 2014-10-28 14:22:38 | Re: WIP: Access method extendability |