Alternative variable length structure

Поиск
Список
Период
Сортировка
От ITAGAKI Takahiro
Тема Alternative variable length structure
Дата
Msg-id 20050908174102.4C76.ITAGAKI.TAKAHIRO@lab.ntt.co.jp
обсуждение исходный текст
Ответы Re: Alternative variable length structure  (Josh Berkus <josh@agliodbs.com>)
Re: Alternative variable length structure  (Andrew Dunstan <andrew@dunslane.net>)
Re: Alternative variable length structure  (Manfred Koizar <mkoi-pg@aon.at>)
Re: Alternative variable length structure  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-hackers
Hi Hackers,

PostgreSQL can treat variable-length data flexibly, but therefore
it consumes more spaces if we store short data. Headers of
variable-length types use 4 bytes regardless of the data length.

My idea is to change the header itself to variable-length.
In order to reduce the size of short data, I wrote a patch to encode
lengths into the first several bits of structure. Also, the alignments
of the types were changed to 'char' from 'int'.


I know my patch is still insufficient, for example, the types cannot
be TOASTed. But I guess this compression works well for short text.

I'll appreciate any comments.
thanks.


---- the result of patch ----

# create table txttbl (v1 text, v2 text, v3 text, v4 text);
# create table strtbl (v1 string, v2 string, v3 string, v4 string);

# insert into txttbl values('A', 'B', 'C', 'D');
# insert into strtbl values('A', 'B', 'C', 'D');

# select * from pgstattuple('txttbl');
-[ RECORD 1 ]------+------
table_len          | 8192
tuple_count        | 1
tuple_len          | 57    <-- 28 + (5+3) + (5+3) + (5+3) + (5)
...

# select * from pgstattuple('strtbl');
-[ RECORD 1 ]------+------
table_len          | 8192
tuple_count        | 1
tuple_len          | 36    <-- 28 + 2 + 2 + 2 + 2
...

---
ITAGAKI Takahiro
NTT Cyber Space Laboratories

Вложения

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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: statement logging / extended query protocol issues
Следующее
От: "Larry Rosenman"
Дата:
Сообщение: Re: [COMMITTERS] pgsql: Update timezone data files to release 2005m of the zic database.