MinIndexTupleSize seems slightly wrong

Поиск
Список
Период
Сортировка
От Peter Geoghegan
Тема MinIndexTupleSize seems slightly wrong
Дата
Msg-id CAH2-WzkQmb54Kbx-YHXstRKXcNc+_87jwV3DRb54xcybLR7Oig@mail.gmail.com
обсуждение исходный текст
Ответы Re: MinIndexTupleSize seems slightly wrong  (Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>)
Список pgsql-hackers
itup.h says of MinIndexTupleSize/MaxIndexTuplesPerPage:

/*
 * MaxIndexTuplesPerPage is an upper bound on the number of tuples that can
 * fit on one index page.  An index tuple must have either data or a null
 * bitmap, so we can safely assume it's at least 1 byte bigger than a bare
 * IndexTupleData struct.  We arrive at the divisor because each tuple
 * must be maxaligned, and it must have an associated item pointer.
 */
#define MinIndexTupleSize MAXALIGN(sizeof(IndexTupleData) + 1)
#define MaxIndexTuplesPerPage   \
    ((int) ((BLCKSZ - SizeOfPageHeaderData) / \
            (MAXALIGN(sizeof(IndexTupleData) + 1) + sizeof(ItemIdData))))

However, that at least seems questionable to me. See _bt_pgaddtup()
for a simple example of this -- "minus infinity" items on internal
pages are sized sizeof(IndexTupleData).

The code still seems fine to me, since that only happens at most once
per page. Is it worth noting the exception?

-- 
Peter Geoghegan


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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: Native partitioning tablespace inheritance
Следующее
От: David Rowley
Дата:
Сообщение: Re: Instability in partition_prune test?