aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeff Davis <jdavis@postgresql.org>2020-03-24 18:19:51 -0700
committerJeff Davis <jdavis@postgresql.org>2020-03-24 18:30:04 -0700
commitdd8e19132acfbb28d579288a412ed6c0a5ea338b (patch)
tree00f77cc5a56e95ff1ffb9043aae25859ca4e1563 /src
parent3649133b147638f25933c93e3d4f6b920da50332 (diff)
downloadpostgresql-dd8e19132acfbb28d579288a412ed6c0a5ea338b.tar.gz
postgresql-dd8e19132acfbb28d579288a412ed6c0a5ea338b.zip
Consider disk-based hash aggregation to implement DISTINCT.
Correct oversight in 1f39bce0. If enable_hashagg_disk=true, we should consider hash aggregation for DISTINCT when applicable.
Diffstat (limited to 'src')
-rw-r--r--src/backend/optimizer/plan/planner.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c
index 5da05283822..b65abf6046d 100644
--- a/src/backend/optimizer/plan/planner.c
+++ b/src/backend/optimizer/plan/planner.c
@@ -4868,8 +4868,8 @@ create_distinct_paths(PlannerInfo *root,
Size hashentrysize = hash_agg_entry_size(
0, cheapest_input_path->pathtarget->width, 0);
- /* Allow hashing only if hashtable is predicted to fit in work_mem */
- allow_hash = (hashentrysize * numDistinctRows <= work_mem * 1024L);
+ allow_hash = enable_hashagg_disk ||
+ (hashentrysize * numDistinctRows <= work_mem * 1024L);
}
if (allow_hash && grouping_is_hashable(parse->distinctClause))