Skip to content

Commit

Permalink
Add reloptkind to debug output
Browse files Browse the repository at this point in the history
This commit adds the reloptkind to the debug optimizer printout so that
we can see the kind of relation that is being built.
  • Loading branch information
mkindahl authored and erimatnor committed May 27, 2020
1 parent 97cbaf5 commit d31135e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
16 changes: 15 additions & 1 deletion tsl/src/debug.c
Expand Up @@ -44,6 +44,20 @@

static void appendExpr(StringInfo buf, const Node *expr, const List *rtable);

static const char *reloptkind_name[] = {
[RELOPT_BASEREL] = "BASEREL",
[RELOPT_JOINREL] = "JOINREL",
[RELOPT_OTHER_MEMBER_REL] = "OTHER_MEMBER_REL",
#if PG11_GE
[RELOPT_OTHER_JOINREL] = "OTHER_JOINREL",
#endif
[RELOPT_UPPER_REL] = "UPPER_REL",
#if PG11_GE
[RELOPT_OTHER_UPPER_REL] = "OTHER_UPPER_REL",
#endif
[RELOPT_DEADREL] = "DEADREL",
};

const char *upperrel_stage_name[] = {
[UPPERREL_SETOP] = "SETOP",
#if PG11_GE
Expand Down Expand Up @@ -466,7 +480,7 @@ tsl_debug_append_pathlist(StringInfo buf, PlannerInfo *root, List *pathlist, int
void
tsl_debug_append_rel(StringInfo buf, PlannerInfo *root, RelOptInfo *rel)
{
appendStringInfoString(buf, "RELOPTINFO (");
appendStringInfo(buf, "RELOPTINFO [%s] (names: ", reloptkind_name[rel->reloptkind]);
appendRelids(buf, root, rel->relids);
appendStringInfo(buf, "): rows=%.0f width=%d\n", rel->rows, rel->reltarget->width);

Expand Down
8 changes: 4 additions & 4 deletions tsl/test/expected/debug_notice.out
Expand Up @@ -78,7 +78,7 @@ GROUP BY 1, 2
HAVING avg(temp) > 4
ORDER BY 1, 2;
DEBUG: In tsl_set_rel_pathlist:
RELOPTINFO (hyper): rows=36 width=20
RELOPTINFO [BASEREL] (names: hyper): rows=36 width=20
path list:
Append [parents: hyper] rows=37 cost=100.00..412.58
CustomScan (DataNodeScanPath) [parents: hyper] rows=9 cost=100.00..128.09
Expand Down Expand Up @@ -115,7 +115,7 @@ GROUP BY 1, 2
HAVING avg(temp) > 4
ORDER BY 1, 2;
DEBUG: Stage GROUP_AGG in get_foreign_upper_paths:
RELOPTINFO (hyper): rows=9 width=20
RELOPTINFO [OTHER_UPPER_REL] (names: hyper): rows=9 width=20
path list:
CustomScan (DataNodeScanPath) [parents: hyper] rows=9 cost=100.09..128.32
Agg [parents: hyper] rows=3 cost=128.18..128.34
Expand All @@ -125,7 +125,7 @@ RELOPTINFO (hyper): rows=9 width=20


DEBUG: Stage GROUP_AGG in get_foreign_upper_paths:
RELOPTINFO (hyper): rows=19 width=20
RELOPTINFO [OTHER_UPPER_REL] (names: hyper): rows=19 width=20
path list:
CustomScan (DataNodeScanPath) [parents: hyper] rows=19 cost=100.19..156.69
Agg [parents: hyper] rows=6 cost=156.61..157.18 has pathkeys
Expand All @@ -134,7 +134,7 @@ RELOPTINFO (hyper): rows=19 width=20


DEBUG: Stage GROUP_AGG in get_foreign_upper_paths:
RELOPTINFO (hyper): rows=9 width=20
RELOPTINFO [OTHER_UPPER_REL] (names: hyper): rows=9 width=20
path list:
CustomScan (DataNodeScanPath) [parents: hyper] rows=9 cost=100.09..128.32
Agg [parents: hyper] rows=3 cost=128.18..128.34
Expand Down

0 comments on commit d31135e

Please sign in to comment.