Re: Two different defs of MAX_TUPLES_PER_PAGE

From: ITAGAKI Takahiro <itagaki(dot)takahiro(at)lab(dot)ntt(dot)co(dot)jp>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Two different defs of MAX_TUPLES_PER_PAGE
Date: 2005-09-02 05:40:37
Message-ID: 20050902141552.4763.ITAGAKI.TAKAHIRO@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> #define MAX_TUPLES_PER_PAGE ((BLCKSZ - 1) / (MAXALIGN(offsetof(HeapTupleHeaderData, t_bits)) + sizeof(ItemIdData)) + 1)
> (I believe that both modules want a ceiling definition not a floor
> definition, ie round up any fraction. The -1 / +1 trick is of course
> just one way to get that.)

Don't you think about PageHeaderData? Also I guess a floor definition is ok
because 'number of tuples' is an integer. How about the following?

((BLCKSZ - offsetof(PageHeaderData, pd_linp)) /
(MAXALIGN(offsetof(HeapTupleHeaderData, t_bits)) + sizeof(ItemIdData)))

> Also, is this something that should be in a common header file? If so
> which one? BLCKSZ, HeapTupleHeaderData, and ItemIdData are all defined
> in different places ...

Considering include-hierarchy, I think bufpage.h is a good place.

---
ITAGAKI Takahiro
NTT Cyber Space Laboratories

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hannu Krosing 2005-09-02 06:36:26 Question about explain of index scan
Previous Message Tino Wildenhain 2005-09-02 05:38:31 Re: typo? was: Version number in psql banner