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

Re: NULL saves disk space?

From: "Massa, Harald Armin" <harald(at)2ndquadrant(dot)de>
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:08:45
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
>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.

The short answer:
do not even think about it.

NULL has  a well defined meaning within SQL: "we do not know the
value", with "well defined" being something totally different from

With "using NULL as false" you woud get:

select whatever from yourtable where not (booleancolumn = true )

would result in ....wait for it .... zero rows.

Because "NULL" is not "not =" to true.

There is no potential diskspace saving in the world that could be
worth those troubles.


Harald Armin Massa
PostgreSQL  Training, Services  and Support

2ndQuadrant Deutschland GmbH
GF: Harald Armin Massa
Amtsgericht Stuttgart, HRB 736399

In response to

pgsql-general by date

Next:From: c kDate: 2011-04-28 14:11:50
Subject: Re: plpython module import errors
Previous:From: David JohnstonDate: 2011-04-28 13:47:01
Subject: Re: NULL saves disk space?

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