Index padding optimization

Поиск
Список
Период
Сортировка
От ITAGAKI Takahiro
Тема Index padding optimization
Дата
Msg-id 20060113122933.4E1E.ITAGAKI.TAKAHIRO@lab.ntt.co.jp
обсуждение исходный текст
Ответы Re: Index padding optimization  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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

Вложения

В списке pgsql-patches по дате отправления:

Предыдущее
От: Christopher Kings-Lynne
Дата:
Сообщение: Re: patch to create system view that lists cursors
Следующее
От: Tom Lane
Дата:
Сообщение: Re: patch to create system view that lists cursors