Re: size cost for null fields

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Vance Maverick" <vmaverick(at)pgp(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: size cost for null fields
Date: 2007-12-14 18:12:10
Message-ID: 87prx92lj9.fsf@oxford.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Vance Maverick" <vmaverick(at)pgp(dot)com> writes:

> Do I have this right? If so, the side table sounds like the right choice....

No, if the null bit is set then the field isn't stored at all. You don't pay
the alignment or storage overhead at all.

The only cost is for the null bitmap itself. If you have *any* null fields
then you pay one bit for *every* field plus alignment to a 4-byte boundary.
Except there's one available free byte so if you have 8 or fewer fields even
that is entirely free.

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
Get trained by Bruce Momjian - ask me about EnterpriseDB's PostgreSQL training!

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andrej Ricnik-Bay 2007-12-14 18:45:08 Re: Hijack!
Previous Message Gregory Stark 2007-12-14 17:49:13 Re: mssql migration and boolean to integer problems