Boolean storage takes up 1 byte?

Поиск
Список
Период
Сортировка
От Thom Brown
Тема Boolean storage takes up 1 byte?
Дата
Msg-id bddc86150910010337i19ffd46fm272d8127ed97cdbb@mail.gmail.com
обсуждение исходный текст
Ответы Re: Boolean storage takes up 1 byte?
Список 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 по дате отправления:

Предыдущее
От: Rakotomandimby Mihamina
Дата:
Сообщение: [OT] Relocation lookup
Следующее
От: Sam Mason
Дата:
Сообщение: Re: Boolean storage takes up 1 byte?