Re: Reduce NUMERIC size by 2 bytes, reduce max length to 508 digits

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: "John D(dot) Burger" <john(at)mitre(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Reduce NUMERIC size by 2 bytes, reduce max length to 508 digits
Date: 2005-12-05 18:31:20
Message-ID: 1213.1133807480@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers pgsql-patches

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> The limit seems to be around 150k digits:

It's exactly 10^(128K), as I've mentioned more than once.

> So, with the patch, the storage length is going from 1000 digits to 508,
> but the computational length is reduced from around 150k digits to 508.
> Now, because no one has complained about the 1000-digit limit, it is
> unlikely that anyone is doing calculations over 1000 or the would have
> had problems with storing the value,

Only if they declared their columns as numeric(N) and not just plain
unconstrained numeric. Not to mention the possibility that they're
doing the same thing you just did, ie computing values and returning
them to the client without ever storing them in a table. So I don't
think the above reasoning is defensible.

> Not only does 4000! not work, but 400! doesn't even work. I just lost
> demo "wow" factor points!

It looks like the limit would be about factorial(256).

The question remains, though, is this computational range good for
anything except demos?

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-12-05 18:44:41 Re: troubleshooting hung postmasters
Previous Message Bruce Momjian 2005-12-05 17:38:17 Reduce NUMERIC size by 2 bytes, reduce max length to 508 digits

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2005-12-05 19:02:07 Re: [PATCHES] snprintf() argument reordering not working
Previous Message Tom Lane 2005-12-05 18:19:57 Re: [PATCHES] snprintf() argument reordering not working

Browse pgsql-patches by date

  From Date Subject
Next Message Peter Eisentraut 2005-12-05 18:41:48 Re: mvcc.sgml make up
Previous Message Tom Lane 2005-12-05 18:19:57 Re: [PATCHES] snprintf() argument reordering not working