Optimization of the alignment padding - Mailing list pgsql-hackers

From ITAGAKI Takahiro
Subject Optimization of the alignment padding
Date
Msg-id 20051109153003.549B.ITAGAKI.TAKAHIRO@lab.ntt.co.jp
Whole thread Raw
Responses Re: Optimization of the alignment padding  (Alvaro Herrera <alvherre@commandprompt.com>)
List pgsql-hackers
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

Attachment

pgsql-hackers by date:

Previous
From: daveg
Date:
Subject: Re: Exclusive lock for database rename
Next
From: sandeep satpal
Date:
Subject: How postgres find OID of function from opclassoid