Search Postgresql Archives

Re: Storage cost of a null column

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux