Skip to content

Commit 926ecf8

Browse files
committed
Revert "Use CP_SMALL_TLIST for hash aggregate"
This reverts commit 4cad253 due to a performance regression. It will be replaced by a new approach in an upcoming commit. Reported-by: Andres Freund Discussion: https://postgr.es/m/20200614181418.mx4bvljmfkkhoqzl@alap3.anarazel.de Backpatch-through: 13
1 parent b074813 commit 926ecf8

File tree

2 files changed

+6
-26
lines changed

2 files changed

+6
-26
lines changed

contrib/postgres_fdw/expected/postgres_fdw.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2715,7 +2715,7 @@ select sum(c1) from ft1 group by c2 having avg(c1 * (random() <= 1)::int) > 100
27152715
Group Key: ft1.c2
27162716
Filter: (avg((ft1.c1 * ((random() <= '1'::double precision))::integer)) > '100'::numeric)
27172717
-> Foreign Scan on public.ft1
2718-
Output: c2, c1
2718+
Output: c1, c2
27192719
Remote SQL: SELECT "C 1", c2 FROM "S 1"."T 1"
27202720
(10 rows)
27212721

@@ -2964,7 +2964,7 @@ select sum(c1) filter (where (c1 / c1) * random() <= 1) from ft1 group by c2 ord
29642964
Output: sum(c1) FILTER (WHERE ((((c1 / c1))::double precision * random()) <= '1'::double precision)), c2
29652965
Group Key: ft1.c2
29662966
-> Foreign Scan on public.ft1
2967-
Output: c2, c1
2967+
Output: c1, c2
29682968
Remote SQL: SELECT "C 1", c2 FROM "S 1"."T 1"
29692969
(9 rows)
29702970

src/backend/optimizer/plan/createplan.c

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2113,22 +2113,12 @@ create_agg_plan(PlannerInfo *root, AggPath *best_path)
21132113
Plan *subplan;
21142114
List *tlist;
21152115
List *quals;
2116-
int flags;
21172116

21182117
/*
21192118
* Agg can project, so no need to be terribly picky about child tlist, but
2120-
* we do need grouping columns to be available. We are a bit more careful
2121-
* with hash aggregate, where we explicitly request small tlist to
2122-
* minimize I/O needed for spilling (we can't be sure spilling won't be
2123-
* necessary, so we just do it every time).
2119+
* we do need grouping columns to be available
21242120
*/
2125-
flags = CP_LABEL_TLIST;
2126-
2127-
/* ensure small tlist for hash aggregate */
2128-
if (best_path->aggstrategy == AGG_HASHED)
2129-
flags |= CP_SMALL_TLIST;
2130-
2131-
subplan = create_plan_recurse(root, best_path->subpath, flags);
2121+
subplan = create_plan_recurse(root, best_path->subpath, CP_LABEL_TLIST);
21322122

21332123
tlist = build_path_tlist(root, &best_path->path);
21342124

@@ -2210,26 +2200,16 @@ create_groupingsets_plan(PlannerInfo *root, GroupingSetsPath *best_path)
22102200
int maxref;
22112201
List *chain;
22122202
ListCell *lc;
2213-
int flags;
22142203

22152204
/* Shouldn't get here without grouping sets */
22162205
Assert(root->parse->groupingSets);
22172206
Assert(rollups != NIL);
22182207

22192208
/*
22202209
* Agg can project, so no need to be terribly picky about child tlist, but
2221-
* we do need grouping columns to be available. We are a bit more careful
2222-
* with hash aggregate, where we explicitly request small tlist to
2223-
* minimize I/O needed for spilling (we can't be sure spilling won't be
2224-
* necessary, so we just do it every time).
2210+
* we do need grouping columns to be available
22252211
*/
2226-
flags = CP_LABEL_TLIST;
2227-
2228-
/* ensure small tlist for hash aggregate */
2229-
if (best_path->aggstrategy == AGG_HASHED)
2230-
flags |= CP_SMALL_TLIST;
2231-
2232-
subplan = create_plan_recurse(root, best_path->subpath, flags);
2212+
subplan = create_plan_recurse(root, best_path->subpath, CP_LABEL_TLIST);
22332213

22342214
/*
22352215
* Compute the mapping from tleSortGroupRef to column index in the child's

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