Skip site navigation (1) Skip section navigation (2)

Index padding optimization

From: ITAGAKI Takahiro <itagaki(dot)takahiro(at)lab(dot)ntt(dot)co(dot)jp>
To: pgsql-patches(at)postgresql(dot)org
Subject: Index padding optimization
Date: 2006-01-13 04:12:37
Message-ID: (view raw, whole thread or download thread mbox)
Lists: 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

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: index-padding.patch
Description: application/octet-stream (32.3 KB)


pgsql-patches by date

Next:From: Tom LaneDate: 2006-01-13 04:23:25
Subject: Re: patch to create system view that lists cursors
Previous:From: Christopher Kings-LynneDate: 2006-01-13 02:02:35
Subject: Re: patch to create system view that lists cursors

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group