Re: Storage cost of a null column

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Storage cost of a null column
Дата
Msg-id 3996.1080934558@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Storage cost of a null column  (Randall Skelton <skelton@brutus.uwaterloo.ca>)
Ответы Re: Storage cost of a null column  (Randall Skelton <skelton@brutus.uwaterloo.ca>)
Список pgsql-general
Randall Skelton <skelton@brutus.uwaterloo.ca> writes:
> What is the storage cost of a null entry in a column?

If you have even one, all the rest in that row are free, so your scheme
sounds reasonable.

Null columns are simply not stored.  There is a bitmap at the start of
the row with one bit per column, indicating which ones are null or not
null.  However we omit the bitmap if all columns are nonnull in a
particular row.  So it's reasonable to consider the cost of the first
null as being the size of the bitmap (N bits for an N-column table,
rounded up).  The rest are free.

>  Because of this, we made a decision that we would have hundreds of 2
> column tables (timestamp, value) and use unions, intersections, and

Narrow tables are a dead loss if you're concerned about storage space
--- you'll get eaten by the per-row overhead, which is a minimum of 28
bytes per row.

            regards, tom lane

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

Предыдущее
От: John DeSoi
Дата:
Сообщение: Re: row-level security model
Следующее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: Storage cost of a null column