Re: probable faq: internal format of numerics

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Brian Hurt <bhurt(at)janestcapital(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: probable faq: internal format of numerics
Date: 2006-04-25 18:09:53
Message-ID: 22801.1145988593@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Brian Hurt <bhurt(at)janestcapital(dot)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

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Ennio-Sr 2006-04-25 20:12:40 How to obtain algebraic sum of equal lines
Previous Message Brian Hurt 2006-04-25 16:05:00 Re: probable faq: internal format of numerics