Commit 1b2c2946 authored by Jeff Davis's avatar Jeff Davis

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
parent 47c71879
......@@ -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);
}
/*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment