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: table-padding.patch
Description: Binary data

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq

Reply via email to