Re: probable faq: internal format of numerics - Mailing list pgsql-novice

From Tom Lane
Subject Re: probable faq: internal format of numerics
Date
Msg-id 22801.1145988593@sss.pgh.pa.us
Whole thread Raw
In response to Re: probable faq: internal format of numerics  (Brian Hurt <bhurt@janestcapital.com>)
List pgsql-novice
Brian Hurt <bhurt@janestcapital.com> writes:
> That said, it looks like they're doing a variant of my #2- they're
> holding 5 decimal digits every 2 bytes, plus an extra byte or so for the
> sign.

Four digits per 2 bytes, actually ... five wouldn't fit (99999 > 65535).

> But consider the NumericVar structure defined in numeric.c- is
> one of those stored with every row of a table,

NumericVar is just a transient calculational representation.
NumericData (in numeric.h) is what's stored in the database.  So it's
basically 8 bytes overhead plus 2 bytes for each group of 4 decimal
digits.

            regards, tom lane

pgsql-novice by date:

Previous
From: Brian Hurt
Date:
Subject: Re: probable faq: internal format of numerics
Next
From: Ennio-Sr
Date:
Subject: How to obtain algebraic sum of equal lines