Re: Two different defs of MAX_TUPLES_PER_PAGE - Mailing list pgsql-hackers

From ITAGAKI Takahiro
Subject Re: Two different defs of MAX_TUPLES_PER_PAGE
Date
Msg-id 20050902141552.4763.ITAGAKI.TAKAHIRO@lab.ntt.co.jp
Whole thread Raw
In response to Re: Two different defs of MAX_TUPLES_PER_PAGE  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Two different defs of MAX_TUPLES_PER_PAGE
List pgsql-hackers
Tom Lane <tgl@sss.pgh.pa.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




pgsql-hackers by date:

Previous
From: Tino Wildenhain
Date:
Subject: Re: typo? was: Version number in psql banner
Next
From: Hannu Krosing
Date:
Subject: Question about explain of index scan