From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Randall Skelton <skelton(at)brutus(dot)uwaterloo(dot)ca> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Storage cost of a null column |
Date: | 2004-04-02 19:35:58 |
Message-ID: | 3996.1080934558@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Randall Skelton <skelton(at)brutus(dot)uwaterloo(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Randall Skelton | 2004-04-02 19:47:41 | Re: Storage cost of a null column |
Previous Message | Martijn van Oosterhout | 2004-04-02 19:30:36 | Re: Storage cost of a null column |