Re: Proposal for Byte savings in VarBit structure

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gokulakannan Somasundaram <gokul007(at)gmail(dot)com>
Cc: pgsql-hackers list <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal for Byte savings in VarBit structure
Date: 2010-03-21 20:07:02
Message-ID: 27052.1269202022@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Gokulakannan Somasundaram <gokul007(at)gmail(dot)com> writes:
> I was looking at the VarBit data structure and found out that instead of
> storing the number of bits in four bytes, we can save the number of bits
> that are valid in the last byte. Since we already store the number of bytes
> in Varlena Header, we can calculate the number of valid bits by doing the
> small math. ( (No. of bytes-1) * 8 + valid bits in the last byte).
> This would save atleast 8 bytes for someone, who is using the varbit data
> type using less than 24 bits.

This might be worth considering in a release cycle where we were going
to break on-disk data compatibility for some other reason. But I can
hardly imagine wanting to do it by itself. Marginal space savings for
the "bit" types just isn't that exciting.

Maybe we should start a special section of TODO for "things we might do
next time we break data compatibility".

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-03-21 20:27:39 Re: proposal: more practical view on function's source code
Previous Message Gokulakannan Somasundaram 2010-03-21 19:36:42 Proposal for Byte savings in VarBit structure