Re:

From: Manfred Koizar <mkoi-pg(at)aon(dot)at>
To: Francisco Reyes <lists(at)natserv(dot)com>
Cc: pgsql General List <pgsql-general(at)postgresql(dot)org>
Subject: Re:
Date: 2002-07-04 18:50:34
Message-ID: l559iuc6manb26ohn53cqu7du2a039ilpc@4ax.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 4 Jul 2002 14:06:31 -0400 (EDT), Francisco Reyes
<lists(at)natserv(dot)com> wrote:
>How much space does "NULL" takes on a varchar.

Francisco,

the simple answer is: no space.

The more complete answer is: The NULL state of all columns is stored
in a bitmap. If a row does not contain any NULL column, the bitmap is
omitted. So the first NULL in a row causes the bitmap to be created,
more NULLs in the same row are free. In v7.2 the size of the bitmap
is one bit per column (sic!) rounded up to an architecture specific
value, usually 4 or 8 bytes.

>I have a table where possibly less than 40% of the records will have a
>value. I am wondering if I should go with a second table for those that
>have the values or if NULL is small enough that it won't be much an
>overhead for the possibly 60% instances when the column would be empty.

If there are no other reasons for having a second table, don't bother
with it.

Servus
Manfred

In response to

  • at 2002-07-04 18:06:31 from Francisco Reyes

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Glatt is a Dumbass 2002-07-04 19:17:56 Re: I am being interviewed by OReilly
Previous Message strange 2002-07-04 18:50:16 Re: