Re: size cost for null fields - Mailing list pgsql-general

From Gregory Stark
Subject Re: size cost for null fields
Date
Msg-id 87prx92lj9.fsf@oxford.xeocode.com
Whole thread Raw
In response to size cost for null fields  ("Vance Maverick" <vmaverick@pgp.com>)
List pgsql-general
"Vance Maverick" <vmaverick@pgp.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!

pgsql-general by date:

Previous
From: Gregory Stark
Date:
Subject: Re: mssql migration and boolean to integer problems
Next
From: "Andrej Ricnik-Bay"
Date:
Subject: Re: Hijack!