Fix HashAgg regression from choosing too many initial buckets.

Diagnosis by Andres.

Reported-by: Pavel Stehule
Discussion: https://postgr.es/m/CAFj8pRDLVakD5Aagt3yZeEQeTeEWaS3YE5h8XC3Q3qJ6TYkc2Q%40mail.gmail.com
Backpatch-through: 13
This commit is contained in:
Jeff Davis 2020-06-08 20:59:45 -07:00
parent de4a259896
commit 2174d40117
1 changed files with 2 additions and 6 deletions

View File

@ -294,9 +294,6 @@
#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);
}
/*