X-Original-To: pgsql-docs-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A928D541E6 for ; Sat, 30 Apr 2005 21:03:41 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 92403-06 for ; Sun, 1 May 2005 00:03:36 +0000 (GMT) Received: from fetter.org (dsl092-188-065.sfo1.dsl.speakeasy.net [66.92.188.65]) by svr1.postgresql.org (Postfix) with ESMTP id C46F253F6F for ; Sat, 30 Apr 2005 21:03:35 -0300 (ADT) Received: from fetter.org (localhost.localdomain [127.0.0.1]) by fetter.org (8.13.1/8.12.10) with ESMTP id j4103aj6024280 for ; Sat, 30 Apr 2005 17:03:37 -0700 Received: (from shackle@localhost) by fetter.org (8.13.1/8.13.1/Submit) id j4103aaj024279 for pgsql-docs@postgresql.org; Sat, 30 Apr 2005 17:03:36 -0700 Date: Sat, 30 Apr 2005 17:03:36 -0700 From: David Fetter To: PostgreSQL Docs Subject: Storage requirements for NUMERIC Message-ID: <20050501000336.GC22531@fetter.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="k1lZvvs/B4yU6o8G" Content-Disposition: inline User-Agent: Mutt/1.4.2i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.055 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200504/35 X-Sequence-Number: 2965 --k1lZvvs/B4yU6o8G Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Folks, Please find a patch per IRC chat yesterday that clarifies how much space a NUMERIC takes. Cheers, D -- David Fetter david@fetter.org http://fetter.org/ phone: +1 510 893 6100 mobile: +1 415 235 3778 Remember to vote! --k1lZvvs/B4yU6o8G Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="numeric_storage.diff" Index: doc/src/sgml/datatype.sgml =================================================================== RCS file: /projects/cvsroot/pgsql/doc/src/sgml/datatype.sgml,v retrieving revision 1.156 diff -c -r1.156 datatype.sgml *** doc/src/sgml/datatype.sgml 13 Mar 2005 09:36:30 -0000 1.156 --- doc/src/sgml/datatype.sgml 30 Apr 2005 23:57:51 -0000 *************** *** 503,511 **** 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).) --- 503,513 ---- 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, so each numeric needs eight ! bytes in headers and two bytes for each four decimal digits actually ! stored. (In this sense the numeric type is more akin to ! varchar(n) than to ! char(n).) --k1lZvvs/B4yU6o8G--