diff --git a/src/include/access/hash.h b/src/include/access/hash.h index 543d802..c3fc117 100644 --- a/src/include/access/hash.h +++ b/src/include/access/hash.h @@ -230,9 +230,15 @@ typedef HashScanOpaqueData *HashScanOpaque; * * There is no particular upper limit on the size of mapp[], other than * needing to fit into the metapage. (With 8K block size, 1024 bitmaps - * limit us to 256 GB of overflow space...) + * limit us to 256 GB of overflow space...). For smaller block size we + * can not use 1024 bitmaps otherwise the mapp[] will cross the + * block size. However, it is better to use the BLCKSZ to determine the + * maximum number of bitmaps. For example with current formula, if BLCKSZ + * is 1K then there will be 128 bitmaps. This will make mapp[] size to + * 512 bytes, now including the space for page opaque and meta data + * header, the total size will be 968 bytes. */ -#define HASH_MAX_BITMAPS 1024 +#define HASH_MAX_BITMAPS Max(BLCKSZ / 8, 1024) #define HASH_SPLITPOINT_PHASE_BITS 2 #define HASH_SPLITPOINT_PHASES_PER_GRP (1 << HASH_SPLITPOINT_PHASE_BITS)