aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Davis <jdavis@postgresql.org>2020-06-08 20:59:45 -0700
committerJeff Davis <jdavis@postgresql.org>2020-06-08 21:04:16 -0700
commit1b2c29469a58cd9086bd86e20c708eb437564a80 (patch)
treec1b6e3cfbff9dbda602ff62c168bd5b85e94f284
parent47c718792b885c2a06e32cf86f4caca69ce5cda4 (diff)
downloadpostgresql-1b2c29469a58cd9086bd86e20c708eb437564a80.tar.gz
postgresql-1b2c29469a58cd9086bd86e20c708eb437564a80.zip
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
-rw-r--r--src/backend/executor/nodeAgg.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c
index 26111327ca1..331acee2814 100644
--- a/src/backend/executor/nodeAgg.c
+++ b/src/backend/executor/nodeAgg.c
@@ -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);
}
/*