diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2020-11-20 14:41:14 +0200 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2020-11-20 14:57:15 +0200 |
commit | 02a2dbe91d37e521fb0dbeebc79ee9edd051f950 (patch) | |
tree | 732c82b6a444f4e077f3c695e91d40ce09d2c4c8 | |
parent | e7abc1111634f51dfb653fc95bb13cbf2468c466 (diff) |
Skip allocating hash table in EXPLAIN-only mode.
This is a backpatch of commit 2cccb627f1, 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
-rw-r--r-- | src/backend/executor/nodeAgg.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c index cced591d02c..9c88ce661dc 100644 --- a/src/backend/executor/nodeAgg.c +++ b/src/backend/executor/nodeAgg.c @@ -2664,7 +2664,10 @@ ExecInitAgg(Agg *node, EState *estate, int eflags) if (node->aggstrategy == AGG_HASHED) { - build_hash_table(aggstate); + /* Skip massive memory allocation if we are just doing EXPLAIN */ + if (!(eflags & EXEC_FLAG_EXPLAIN_ONLY)) + build_hash_table(aggstate); + aggstate->table_filled = false; /* Compute the columns we actually need to hash on */ aggstate->hash_needed = find_hash_columns(aggstate); |