Re: int8 version of NUMERIC?

From: David Garamond <lists(at)zara(dot)6(dot)isreserved(dot)com>
To: Arjen van der Meijden <acmmailing(at)vulcanus(dot)its(dot)tudelft(dot)nl>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: int8 version of NUMERIC?
Date: 2004-01-11 14:53:09
Message-ID: 40016355.5040203@zara.6.isreserved.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Arjen van der Meijden wrote:
>> In Interbase and Firebird, NUMERIC is implemented as 64-bit integer.
>> This limits the range to NUMERIC(18, *) but for many uses that's
>> adequate. And moreover it's fast and efficient.
>>
>> Is there a way in PostgreSQL to do something similar, i.e. I want to:
>>
>> - use 64-bit ints, not string bits or arbitrary precision which is
>> dubbed as "much slower than ints" in the documentation;
>
> They call that a 'bigint', which is in SQL-spec and I noticed it got
> inserted in firebird 1.5

BIGINT has been part of IB/FB since IB version 6.0 (1999-2000).

>> - use decimals, like NUMERIC(18,4);
> Well, decimal and numeric are both available in postgres
>> - store and retrieve decimal numbers pretty much transparently (e.g. I
>> don't want to remember to insert 123456 for 12.3456 and playing with
>> multiplying/dividing by 10000);
> You can just use 12.3456 in postgres.

Perhaps I wasn't clear enough. What I meant to say was, IB/FB uses
BIGINT internally for NUMERIC & DECIMAL. Thus, they don't actually have
arbitrary precision, they can only support NUMERIC(18, X) or DECIMAL(18,
x). This is probably adequate for most uses. Plus they are fast, since
they use native integers just like BIGINT.

My concern is that, the PostgreSQL docs says NUMERIC & DECIMAL is very
slow compared to INT/BIGINT. Should I worry about that?

--
dave

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Garamond 2004-01-11 15:52:17 CHAR(N) storage requirement
Previous Message Dino Nardini 2004-01-11 14:10:07 Re: [GENERAL] Is my MySQL Gaining ?