Re: Decimal64 and Decimal128 - Mailing list pgsql-hackers

From Thomas Munro
Subject Re: Decimal64 and Decimal128
Date
Msg-id CAEepm=2+2N62dD6PK37PdEe1WuzdjuX+yzLS1KzfN=NQM_vq4g@mail.gmail.com
Whole thread Raw
In response to Re: Decimal64 and Decimal128  (Feng Tian <ftian@vitessedata.com>)
List pgsql-hackers
On Fri, Sep 25, 2015 at 9:23 AM, Feng Tian <ftian@vitessedata.com> wrote:
>
>
> On Thu, Sep 24, 2015 at 2:17 PM, Feng Tian <ftian@vitessedata.com> wrote:
>>
>>
>>
>> On Thu, Sep 24, 2015 at 1:55 PM, Peter Geoghegan <pg@heroku.com> wrote:
>>>
>>> On Thu, Sep 24, 2015 at 1:53 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>> > Please include the actual patch as an attachment.  We do not consider
>>> > mere
>>> > URLs to be acceptable patch submission format, because that provides no
>>> > permanent record in our archives of what was submitted.
>>>
>>> I was under the impression that this was not intended as a patch
>>> submission.
>>>
>>>
>>> --
>>> Peter Geoghegan
>>
>>
>> If there is enough interest, would be great for it to go into the official
>> contrib dir.
>> Thanks,
>>
>>
> Second thought, the extension depends on decNumber, which is either GPL, or
> ICU license.  Maybe this is trouble.

This is a very cool feature.  I would be great to get a useful class
of decimal numbers into a pass-by-value fixed sized standardised data
type.

The Intel BID library seems to have a more permissive license at first
glance.  I have heard that the Intel library is faster than the IBM
library at a variety of arithmetic and conversions (YMMV; I saw an
unpublished benchmark result that I can't share) on commodity hardware
at least, and it would be interesting to test that.  I wonder if BID
(a single integer significand field) is inherently better for software
implementations than DPD (the significand as an array of 10 bit wide
base-1000 digits called "declets", not entirely unlike our numeric's
encoding).  Those using POWER hardware might want the option to use
DPD though, because they have hardware support for that.

Perhaps ideally there could be a build option to use any of the following:

1.  The IBM decNum library
2.  The IBM DFPAL library[1] (this maps to IBM hardware if available,
or decNum otherwise)
3.  The Intel library
4.  The future built-in C language support[2] (which could use either
binary format!), currently only a proposal but already implemented by
IBM XL C and GCC (using the libraries above)

I have a suspicion that if only one of those has to be chosen, the
Intel library would be best for the majority of users based on license
+ performances.

[1] http://speleotrove.com/decimal/dfpal/dfpalugaio.html
[2] http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1312.pdf,
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1781.pdf

-- 
Thomas Munro
http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: Decimal64 and Decimal128
Next
From: Jim Nasby
Date:
Subject: Re: [PROPOSAL] VACUUM Progress Checker.