EnterpriseDB asked me to develop the attached patch to reduce the on-disk size of numeric and to submit it for inclusion in PG 9.1. After searching the archives, I found a possible design for this by Tom Lane based on an earlier proposal by Simon Riggs.
http://archives.postgresql.org/pgsql-hackers/2007-06/msg00715.php The attached patch implements more or less the design described there, and will essentially knock 2 bytes of the on-disk size of nearly all numeric values anyone is likely to want to store, but without reducing the overall range of the type; so, for people who are storing a lot of numerics, it should save a great deal of storage space and, more importantly, I/O. However, it does so in a way that should be completely backward-compatible from a binary format standpoint, so that pg_upgrade does not break. I'm not entirely happy with the way I handled the variable-length struct, although I don't think it's horrible, either. I'm willing to rework it if someone has a better idea. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise Postgres Company
numeric_2b.patch
Description: Binary data
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers