Proposal for Byte savings in VarBit structure

From: Gokulakannan Somasundaram <gokul007(at)gmail(dot)com>
To: pgsql-hackers list <pgsql-hackers(at)postgresql(dot)org>
Subject: Proposal for Byte savings in VarBit structure
Date: 2010-03-21 19:36:42
Message-ID: 9362e74e1003211236nd6a4f84h479ec95f52b94f44@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,
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.

Waiting for comments.

Thanks,
Gokul.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-03-21 20:07:02 Re: Proposal for Byte savings in VarBit structure
Previous Message Pavel Stehule 2010-03-21 19:06:19 Re: proposal: more practical view on function's source code