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))
Список
Дерево обсуждения
size of NULL field? nazgul@punkass.spam (nazgul)
Re: size of NULL field? Tom Lane <tgl@sss.pgh.pa.us>
Re: size of NULL field? Bruce Momjian <pgman@candle.pha.pa.us>
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
Дата:
От: Tom Lane
Дата:
FAQ