Boolean storage takes up 1 byte? - Mailing list pgsql-general

From Thom Brown
Subject Boolean storage takes up 1 byte?
Date
Msg-id bddc86150910010337i19ffd46fm272d8127ed97cdbb@mail.gmail.com
Whole thread Raw
Responses Re: Boolean storage takes up 1 byte?
List pgsql-general
Hi,

I've read the PostgreSQL documentation page on the boolean datatype (http://www.postgresql.org/docs/8.4/static/datatype-boolean.html) to find out what PostgreSQL's definition of a boolean is, as I believe it is distinctive from a bit(1) datatype (as you can't max() a boolean.. not sure what an efficient alternative to that is).  However, I see that a boolean takes up 1 byte of storage, which is 8 bits.  Is this due to the fact that the value can be null?  I'm not clear as to how a null field is stored, or is that the point... nothing references is so it is defined as null?  If that is the case, can't this be stored as 1 bit?  And does its storage as a byte affect indexing or query planning?

Thom

pgsql-general by date:

Previous
From: Rakotomandimby Mihamina
Date:
Subject: [OT] Relocation lookup
Next
From: Sam Mason
Date:
Subject: Re: Boolean storage takes up 1 byte?