Decimal64 and Decimal128

From: Feng Tian <ftian(at)vitessedata(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Decimal64 and Decimal128
Date: 2015-09-24 20:29:52
Message-ID: CAFWGqnsuyOKdOwsNLVtDU1LLjS=66xmxxxS8Chnng_zSB5_uCg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Here is an extension for 64 and 128 bit decimal types using IEEE decimal
floating point. The original idea/implementation is from
http://pgxn.org/dist/pgdecimal/1.0.0/ Original thread for dicussion is at

http://www.postgresql.org/message-id/CAFj8pRApakE6s-H2yJcXD=UBpukWA6i7rx4VUVTb4PUHgA5FeA@mail.gmail.com

I reimplemented 64/128 bits instead of 32/64 bits. The code use decNumber
library instead of _Decimal64/128 of GCC. Also added more operators.

Compared to numeric type, decimal64 arithmetics is about 2x faster,
decimal128 is about 1.5x faster. However, the cast between decimal and
float4/8 is implemented rather naively and slow. As always, it depends on
workload, decimal may take more, or less space, may be slower if cast is
frequently performed.

Agains, thanks to the original author okbob (Pavel). Enjoy.

Thanks,
Feng

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Feng Tian 2015-09-24 20:31:13 Re: Decimal64 and Decimal128
Previous Message Tom Lane 2015-09-24 20:25:03 Re: Rename withCheckOptions to insertedCheckClauses