Index padding optimization - Mailing list pgsql-patches

From ITAGAKI Takahiro
Subject Index padding optimization
Date
Msg-id 20060113122933.4E1E.ITAGAKI.TAKAHIRO@lab.ntt.co.jp
Whole thread Raw
Responses Re: Index padding optimization
List pgsql-patches
Attached is a patch that removes undesired paddings from b-tree indexes.

The tuples of b-tree index consist of BTItemData and index keys. BTItemData
should be placed only 2 byte alignment, so if the alignment of keys are less
than MAXIMUM_ALIGNOF, we can place them with their minimum alignment instead
of MAXALIGN.


I tested this patch with pgbench on the machine where MAXIMUM_ALIGNOF is 8.
It saved 20% of index file sizes, because accounts_pkey is btree index on
an integer (4 bytes), so the size for one tuple changed as follows:
 - original : 20 bytes = ItemIdData(4) + BTItemData(8) + key(4) + padding(4)
 - patched  : 16 bytes = ItemIdData(4) + BTItemData(8) + key(4)

./pgbench -i -s 100
# select relpages from pg_class where relname='accounts_pkey';
- original : relpages = 27422
- patched  : relpages = 21899

---
ITAGAKI Takahiro
NTT Cyber Space Laboratories

Attachment

pgsql-patches by date:

Previous
From: Christopher Kings-Lynne
Date:
Subject: Re: patch to create system view that lists cursors
Next
From: Tom Lane
Date:
Subject: Re: patch to create system view that lists cursors