agora inbox for pgsql-hackers@postgresql.org
help / color / mirror / Atom feedFrom: Justin Pryzby <pryzbyj@telsasoft.com>
Subject: [PATCH v8 3/8] refactor show_grouping_set_keys
Date: Sun, 23 Feb 2020 23:13:07 -0600
---
src/backend/commands/explain.c | 55 ++++++++++++++++++++--------------
1 file changed, 33 insertions(+), 22 deletions(-)
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index 1d9623619b..9482f68c4b 100644
--- a/src/backend/commands/explain.c
+++ b/src/backend/commands/explain.c
@@ -95,6 +95,8 @@ static void show_grouping_set_info(AggState *aggstate,
List *ancestors,
HashTableInstrumentation *inst,
ExplainState *es);
+static void show_grouping_set_keys(AggState *aggstate, Agg *aggnode, List
+ *context, bool useprefix, ExplainState *es);
static void show_group_keys(GroupState *gstate, List *ancestors,
ExplainState *es);
static void show_sort_group_keys(PlanState *planstate, const char *qlabel,
@@ -2349,6 +2351,37 @@ show_grouping_set_info(AggState *aggstate,
List *context, bool useprefix,
List *ancestors, HashTableInstrumentation *inst,
ExplainState *es)
+{
+ PlanState *planstate = outerPlanState(aggstate);
+
+ ExplainOpenGroup("Grouping Set", NULL, true, es);
+
+ if (sortnode)
+ {
+ show_sort_group_keys(planstate, "Sort Key",
+ sortnode->numCols, sortnode->sortColIdx,
+ sortnode->sortOperators, sortnode->collations,
+ sortnode->nullsFirst,
+ ancestors, es);
+ if (es->format == EXPLAIN_FORMAT_TEXT)
+ es->indent++;
+ }
+
+ show_grouping_set_keys(aggstate, aggnode, context, useprefix, es);
+
+ if (aggnode->aggstrategy == AGG_HASHED ||
+ aggnode->aggstrategy == AGG_MIXED)
+ show_tuplehash_info(inst, NULL, es);
+
+ if (sortnode && es->format == EXPLAIN_FORMAT_TEXT)
+ es->indent--;
+
+ ExplainCloseGroup("Grouping Set", NULL, true, es);
+}
+
+/* Show keys of a grouping set */
+static void
+show_grouping_set_keys(AggState *aggstate, Agg *aggnode, List *context, bool useprefix, ExplainState *es)
{
PlanState *planstate = outerPlanState(aggstate);
Plan *plan = planstate->plan;
@@ -2370,19 +2403,6 @@ show_grouping_set_info(AggState *aggstate,
keysetname = "Group Keys";
}
- ExplainOpenGroup("Grouping Set", NULL, true, es);
-
- if (sortnode)
- {
- show_sort_group_keys(planstate, "Sort Key",
- sortnode->numCols, sortnode->sortColIdx,
- sortnode->sortOperators, sortnode->collations,
- sortnode->nullsFirst,
- ancestors, es);
- if (es->format == EXPLAIN_FORMAT_TEXT)
- es->indent++;
- }
-
ExplainOpenGroup(keysetname, keysetname, false, es);
foreach(lc, gsets)
@@ -2413,15 +2433,6 @@ show_grouping_set_info(AggState *aggstate,
}
ExplainCloseGroup(keysetname, keysetname, false, es);
-
- if (aggnode->aggstrategy == AGG_HASHED ||
- aggnode->aggstrategy == AGG_MIXED)
- show_tuplehash_info(inst, NULL, es);
-
- if (sortnode && es->format == EXPLAIN_FORMAT_TEXT)
- es->indent--;
-
- ExplainCloseGroup("Grouping Set", NULL, true, es);
}
/*
--
2.17.0
--ZljC5FVPx7rxDQQ8
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v8-0004-Gross-hack-to-put-hash-stats-of-subplans-in-the-r.patch"
view thread (24+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: pryzbyj@telsasoft.com
Subject: Re: [PATCH v8 3/8] refactor show_grouping_set_keys
In-Reply-To: <no-message-id-708510@localhost>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox