Skip to content

Commit dd8e191

Browse files
committed
Consider disk-based hash aggregation to implement DISTINCT.
Correct oversight in 1f39bce. If enable_hashagg_disk=true, we should consider hash aggregation for DISTINCT when applicable.
1 parent 3649133 commit dd8e191

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/backend/optimizer/plan/planner.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4868,8 +4868,8 @@ create_distinct_paths(PlannerInfo *root,
48684868
Size hashentrysize = hash_agg_entry_size(
48694869
0, cheapest_input_path->pathtarget->width, 0);
48704870

4871-
/* Allow hashing only if hashtable is predicted to fit in work_mem */
4872-
allow_hash = (hashentrysize * numDistinctRows <= work_mem * 1024L);
4871+
allow_hash = enable_hashagg_disk ||
4872+
(hashentrysize * numDistinctRows <= work_mem * 1024L);
48734873
}
48744874

48754875
if (allow_hash && grouping_is_hashable(parse->distinctClause))

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