Re: size of NULL field?

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: size of NULL field?
Дата
Msg-id 200204151933.g3FJXT912721@candle.pha.pa.us
обсуждение исходный текст
Ответ на Re: size of NULL field?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Tom Lane wrote:
> 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.

Oh, I didn't realize the size of the NULL bitmask was zero if no nulls
exist.  Nice.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

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