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

Lines changed: 2 additions & 6 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy