diff options
Diffstat (limited to 'src/include/access/nbtree.h')
-rw-r--r-- | src/include/access/nbtree.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/include/access/nbtree.h b/src/include/access/nbtree.h index 574aec496f8..91d91a77053 100644 --- a/src/include/access/nbtree.h +++ b/src/include/access/nbtree.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/access/nbtree.h,v 1.109 2007/01/20 18:43:35 neilc Exp $ + * $PostgreSQL: pgsql/src/include/access/nbtree.h,v 1.110 2007/02/05 04:22:18 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -99,13 +99,18 @@ typedef struct BTMetaPageData #define BTREE_VERSION 2 /* current version number */ /* + * Maximum size of a btree index entry, including its tuple header. + * * We actually need to be able to fit three items on every page, * so restrict any one item to 1/3 the per-page available space. + * + * Note: sizeof(PageHeaderData) includes the first ItemId, but we have + * to allow for 2 more, as well as the end-of-page special space. */ #define BTMaxItemSize(page) \ - ((PageGetPageSize(page) - \ - sizeof(PageHeaderData) - \ - MAXALIGN(sizeof(BTPageOpaqueData))) / 3 - sizeof(ItemIdData)) + MAXALIGN_DOWN((PageGetPageSize(page) - \ + MAXALIGN(sizeof(PageHeaderData) + 2*sizeof(ItemIdData)) - \ + MAXALIGN(sizeof(BTPageOpaqueData))) / 3) /* * The leaf-page fillfactor defaults to 90% but is user-adjustable. |