Re: storage size of "bit" data type..

Поиск
Список
Период
Сортировка
От Michael Glaesemann
Тема Re: storage size of "bit" data type..
Дата
Msg-id E464B928-C672-4F6A-9311-63644EA63E36@seespotcode.net
обсуждение исходный текст
Ответ на storage size of "bit" data type..  (Alex Mayrhofer <axelm@nona.net>)
Ответы Re: storage size of "bit" data type..  (Decibel! <decibel@decibel.org>)
Список pgsql-general
On Dec 5, 2007, at 14:19 , Alex Mayrhofer wrote:

> Hi,
>
> i'm trying to find out the storage size for bit(n) data. My initial
> assumption would be that for any 8 bits, one byte of storage is
> required.

select pg_column_size(B'1') as "1bit",
        pg_column_size(B'1111') as "4bits",
        pg_column_size(B'11111111') as "1byte",
        pg_column_size(B'111111111111') as "12bits",
        pg_column_size(B'1111111111111111') as "2bytes",
        pg_column_size(B'11111111111111111') as "17bits",
        pg_column_size(B'111111111111111111111111') as "3bytes";
1bit | 4bits | 1byte | 12bits | 2bytes | 17bits | 3bytes
------+-------+-------+--------+--------+--------+--------
     9 |     9 |     9 |     10 |     10 |     11 |     11
(1 row)

Looks like there's 8 bytes of overhead as well, probably because a
bit string is a varlena type.

Michael Glaesemann
grzm seespotcode net



В списке pgsql-general по дате отправления:

Предыдущее
От: "Joshua D. Drake"
Дата:
Сообщение: Re: pgAccess for PostgreSQL 8.2.5
Следующее
От: Efraín López
Дата:
Сообщение: Re: libpq messages language