Skip site navigation (1) Skip section navigation (2)

Re: NULL saves disk space?

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Phoenix Kiula <phoenix(dot)kiula(at)gmail(dot)com>
Cc: PG-General Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: Re: NULL saves disk space?
Date: 2011-04-28 14:59:39
Message-ID: (view raw or whole thread)
Lists: pgsql-general
On Wed, Apr 27, 2011 at 5:24 PM, Phoenix Kiula <phoenix(dot)kiula(at)gmail(dot)com> wrote:
> Possibly a dumb question but there isn't much about this.
> I have some BOOLEAN columns. 90% of the cases of the columns is FALSE. Do I
> save disk space by having them as NULL instead of FALSE? So my application
> would have conditional code for NULL and TRUE, instead of FALSE and TRUE.
> Thanks...

Yes, NULL values take no additional space, but the row needs a null
bitmap so it is possible that if this was the only NULL then it could
occupy more space.

If you have multiple columns, then you should use NULLs.

 Simon Riggs         
 PostgreSQL Development, 24x7 Support, Training & Services

In response to


pgsql-general by date

Next:From: Alban HertroysDate: 2011-04-28 15:29:33
Subject: Re: GIN index not used
Previous:From: David BorehamDate: 2011-04-28 14:48:32
Subject: Re: SSDs with Postgresql?

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group