Re: size of NULL field?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: size of NULL field?
Дата
Msg-id 23186.1018883410@sss.pgh.pa.us
обсуждение исходный текст
Ответ на size of NULL field?  (nazgul@punkass.spam (nazgul))
Ответы Re: size of NULL field?  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-general
nazgul@punkass.spam (nazgul) writes:
> Hi, I'm wondering how much storage space a NULL value takes up?

None.

However, as soon as you have any NULLs in a particular table row, the
row needs to store a NULL-value bitmap, which has one bit per table
column to show which ones are nulls.  So you could say that the first
NULL in a given row costs you 4 bytes (more if you have > 32 columns).
Additional NULLs in the row are free.

            regards, tom lane

PS: if you're on a machine where MAXALIGN is 8, the cost quantum is
8 bytes not 4.  But I think it's usually 4 on peecee hardware.

В списке pgsql-general по дате отправления:

Предыдущее
От: Lamar Owen
Дата:
Сообщение: Re: I would preffer that postgresql start with the flag -i
Следующее
От: Tom Lane
Дата:
Сообщение: Re: I: Migrating a very large db