Tom Lane wrote:
Brian Hurt <bhurt@janestcapital.com> writes:
This is probably a FAQ, but I've googled the question and haven't found
an answer. What is the internal format of numerics?
"Use the source, Luke"
This is what I was hoping to not do. It's generally not possible to understand a peice of a project out of context- even well commented and well structured code like the Postgres code looks to be.
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. But consider the NumericVar structure defined in numeric.c- is one of those stored with every row of a table, or are most of the values stored once per table and only the digits stored in the row? From a cursory reading of the code, it's hard for me to tell.
Brian