Skip site navigation (1) Skip section navigation (2)

Re: NUMERIC size

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: pgsql-docs <pgsql-docs(at)postgresql(dot)org>
Subject: Re: NUMERIC size
Date: 2012-03-22 19:41:24
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-docs
On Wed, Mar 21, 2012 at 10:35 PM, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
>> Numeric values are physically stored without any extra leading or
>> trailing zeroes. Thus, the declared precision and scale of a column
>> are maximums, not fixed allocations. (In this sense the numeric type
>> is more akin to varchar(n) than to char(n).) The actual storage
>> requirement is two bytes for each group of four decimal digits,
>> plus five to eight bytes overhead.
> The last sentence of the above seems not to be correct. Because,
> thanks to the reduction of NUMERIC size (committed in 9.1), its header
> size is three, five or eight for now. Attached patch fixes this.

Nice catch.  Committed.

Robert Haas
The Enterprise PostgreSQL Company

In response to

pgsql-docs by date

Next:From: Robert HaasDate: 2012-03-22 19:49:14
Subject: Re: [PATCH] Use idiomatic style for varlena structs
Previous:From: Robert HaasDate: 2012-03-22 19:41:12
Subject: pgsql: Update docs on numeric storage requirements.

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group