Fix HashAgg regression from choosing too many initial buckets.
Diagnosis by Andres.
Reported-by: Pavel Stehule
Discussion:
Backpatch-through: 13
#define HASHAGG_READ_BUFFER_SIZE BLCKSZ
#define HASHAGG_WRITE_BUFFER_SIZE BLCKSZ
-/* minimum number of initial hash table buckets */
-#define HASHAGG_MIN_BUCKETS 256
-
/*
* Estimate chunk overhead as a constant 16 bytes. XXX: should this be
* improved?
@@ -1926,9 +1923,8 @@ hash_choose_num_buckets(double hashentrysize, long ngroups, Size memory)
if (nbuckets > max_nbuckets)
nbuckets = max_nbuckets;
- if (nbuckets < HASHAGG_MIN_BUCKETS)
- nbuckets = HASHAGG_MIN_BUCKETS;
- return nbuckets;
+
+ return Max(nbuckets, 1);
}
/*
