View Single Post

   
  #2 (permalink)  
Old 04-11-2008, 05:33 AM
Tom Lane
 
Posts: n/a
Default Re: Two different defs of MAX_TUPLES_PER_PAGE

ITAGAKI Takahiro <itagaki.takahiro@lab.ntt.co.jp> writes:
> I found two different definitions of MAX_TUPLES_PER_PAGE.
> Which is reasonable? Or do they have another meaning?


Hmm, I think those were both my fault at different times :-(.
Right now I am thinking that they are both not quite right,
in particular it ought to be

#define MAX_TUPLES_PER_PAGE ((BLCKSZ - 1) / (MAXALIGN(offsetof(HeapTupleHeaderData, t_bits)) + sizeof(ItemIdData)) + 1)

That is, the heaptuple space is padded to a MAXALIGN boundary, but the
itemid that points to it isn't. Comments?

(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.)

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 ...

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Reply With Quote