From: | ITAGAKI Takahiro <itagaki(dot)takahiro(at)lab(dot)ntt(dot)co(dot)jp> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Optimization of the alignment padding |
Date: | 2005-11-09 07:25:11 |
Message-ID: | 20051109153003.549B.ITAGAKI.TAKAHIRO@lab.ntt.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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 | Content-Type | Size |
---|---|---|
table-padding.patch | application/octet-stream | 7.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Teodor Sigaev | 2005-11-09 07:27:53 | Re: SIGSEGV taken on 8.1 during dump/reload |
Previous Message | Gayathri TK | 2005-11-09 07:18:34 | Accessing libq functions from UDF (shared library) |