From: | Francisco J Reyes <fran(at)natserv(dot)net> |
---|---|
To: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
Cc: | pgsql General List <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: |
Date: | 2002-07-05 16:57:20 |
Message-ID: | 20020705124739.D9157-100000@zoraida.natserv.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, 4 Jul 2002, Bruce Momjian wrote:
> Tom Lane wrote:
> > Q. How much space does a NULL take?
> >
> > A. None; it's not stored. However, if a table row contains any NULLs
> > then it must include a "nulls bitmap" that shows which columns are NULL.
> > The bitmap has one bit per table column. The bitmap is omitted if the
> > row contains no NULLs at all. So, in practice the first NULL you put in
> > a row costs number-of-columns bits. Any additional NULLs in the same
> > row are completely free as far as storage space is concerned.
> >
> > Also, the space effectively occupied by the bitmap depends on alignment
> > considerations, because the total size of the row header and bitmap
> > will be rounded up to a MAXALIGN boundary (either 4 or 8 bytes on
> > most hardware). In 7.3 it's likely that a bitmap for a row of up to
> > 8 columns will be completely free, because the rounded-up header size
> > will be the same with or without it.
>
> I added this to the disk space FAQ item. Let's see how that works:
>
> <P><SMALL>NULL</SMALL>s are stored in bitmaps, so they
> use very little space.</P>
That would work, although we would probably save further questions in the
future if we had the longer explanation on the FAQ or pointed the user to
see the Data Types section of the Docs for more detail.. Then
on the data type section mention (if it already doesn't have it) how the
bitmap is used when there are NULLs.
From | Date | Subject | |
---|---|---|---|
Next Message | Stephan Szabo | 2002-07-05 17:07:09 | Re: two primairy key in one table ? |
Previous Message | Joe Conway | 2002-07-05 16:52:57 | Re: explicit cast error |