reducing NUMERIC size for 9.1

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: reducing NUMERIC size for 9.1
Date: 2010-07-09 14:58:40
Message-ID: AANLkTimMdFxyPPwPlkpWIigBYHTsIt_A2oOVG-erJXHP@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Attachment Content-Type Size
numeric_2b.patch application/octet-stream 11.1 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-07-09 15:07:30 Re: [COMMITTERS] pgsql: Add a hook in ExecCheckRTPerms().
Previous Message Yeb Havinga 2010-07-09 14:57:13 FYI: Ubuntu 10.04 lucid strange segfault