Skip to content

Commit 57b5d84

Browse files
committed
Skip allocating hash table in EXPLAIN-only mode.
This is a backpatch of commit 2cccb62, backpatched due to popular demand. Backpatch to all supported versions. Author: Alexey Bashtanov Discussion: https://www.postgresql.org/message-id/36823f65-050d-ae24-aa4d-a37726998240%40imap.cc
1 parent d01e378 commit 57b5d84

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/backend/executor/nodeAgg.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2454,7 +2454,11 @@ ExecInitAgg(Agg *node, EState *estate, int eflags)
24542454
aggstate->hash_pergroup = pergroups;
24552455

24562456
find_hash_columns(aggstate);
2457-
build_hash_table(aggstate);
2457+
2458+
/* Skip massive memory allocation if we are just doing EXPLAIN */
2459+
if (!(eflags & EXEC_FLAG_EXPLAIN_ONLY))
2460+
build_hash_table(aggstate);
2461+
24582462
aggstate->table_filled = false;
24592463
}
24602464

0 commit comments

Comments
 (0)