Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 1b2c294

Browse files
committed
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
1 parent 47c7187 commit 1b2c294

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/backend/executor/nodeAgg.c

+2-6
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,6 @@
294294
#define HASHAGG_READ_BUFFER_SIZE BLCKSZ
295295
#define HASHAGG_WRITE_BUFFER_SIZE BLCKSZ
296296

297-
/* minimum number of initial hash table buckets */
298-
#define HASHAGG_MIN_BUCKETS 256
299-
300297
/*
301298
* Estimate chunk overhead as a constant 16 bytes. XXX: should this be
302299
* improved?
@@ -1926,9 +1923,8 @@ hash_choose_num_buckets(double hashentrysize, long ngroups, Size memory)
19261923

19271924
if (nbuckets > max_nbuckets)
19281925
nbuckets = max_nbuckets;
1929-
if (nbuckets < HASHAGG_MIN_BUCKETS)
1930-
nbuckets = HASHAGG_MIN_BUCKETS;
1931-
return nbuckets;
1926+
1927+
return Max(nbuckets, 1);
19321928
}
19331929

19341930
/*

0 commit comments

Comments
 (0)