Optimization of the alignment padding

Поиск
Список
Период
Сортировка
Искать
От
ITAGAKI Takahiro
Тема
Optimization of the alignment padding
Дата
Msg-id
20051109153003.549B.ITAGAKI.TAKAHIRO@lab.ntt.co.jp
Список
Дерево обсуждения
Optimization of the alignment padding ITAGAKI Takahiro <itagaki.takahiro@lab.ntt.co.jp>
Re: Optimization of the alignment padding Alvaro Herrera <alvherre@commandprompt.com>
Re: Optimization of the alignment padding Tom Lane <tgl@sss.pgh.pa.us>
Re: Optimization of the alignment padding ITAGAKI Takahiro <itagaki.takahiro@lab.ntt.co.jp>
Re: Optimization of the alignment padding Bruce Momjian <pgman@candle.pha.pa.us>
Hi Hackers,

After the subtransaction had been added,
the size of HeapTupleHeader became 27 bytes.
This consumes extra bytes per tuple for the alignment padding,
especially on systems where MAXIMUM_ALIGNOF is 8.

This patch optimizes the location of the first field,
and reduces the padding. I expect most rows are saved
about 4 bytes, if the table definition is appropriate.

Following is a bit artificial test:
  # CREATE TABLE test (c "char", i int4);
  # INSERT INTO test VALUES('A', 1);
  # SELECT * FROM pgstattuple('test');

the size of a tuple (8.1.0) is 40 bytes:
    [27] HeapTupleHeader
    [ 5] (padding)
    [ 1] c "char"
    [ 3] (padding)
    [ 4] i int4

the size of tuple (patched) is 32 bytes
    [27] HeapTupleHeader
    [ 1] c "char"
    [ 4] i int4

Is this effective? Or are there some problems?
I'll appreciate any comments.
Thanks,
---
ITAGAKI Takahiro
NTT Cyber Space Laboratories
В списке pgsql-hackers по дате отправления
От: daveg
Дата:
От: sandeep satpal
Дата:
FAQ