}
initStringInfo(&buf);
- foreach(lc, context.unrolled_joins)
- {
- pgpa_unrolled_join *ujoin = lfirst(lc);
-
- appendStringInfoChar(&buf, ' ');
- pgpa_debug_out_unrolled_join(&buf, ujoin, rt_identifiers);
- }
- foreach(lc, context.clumped_joins)
- {
- pgpa_clumped_join *cjoin = lfirst(lc);
-
- appendStringInfoChar(&buf, ' ');
- pgpa_debug_out_clumped_join(&buf, cjoin, rt_identifiers);
- }
- foreach(lc, context.gathered_joins)
- {
- pgpa_gathered_join *gathered_join = lfirst(lc);
-
- appendStringInfoChar(&buf, ' ');
- pgpa_debug_out_gathered_join(&buf, gathered_join, rt_identifiers);
- }
-
+ pgpa_output_advice(&buf, &context, rt_identifiers);
elog(LOG, "advice:%s", buf.data);
}
static char *pgpa_cstring_join_clump_strategy(pgpa_join_clump_strategy strategy);
static char *pgpa_cstring_join_strategy(pgpa_join_strategy strategy);
+void
+pgpa_output_advice(StringInfo buf, pgpa_plan_walker_context *context,
+ const char **rt_identifiers)
+{
+ ListCell *lc;
+
+ foreach(lc, context->unrolled_joins)
+ {
+ pgpa_unrolled_join *ujoin = lfirst(lc);
+
+ appendStringInfoChar(buf, ' ');
+ pgpa_debug_out_unrolled_join(buf, ujoin, rt_identifiers);
+ }
+
+ foreach(lc, context->clumped_joins)
+ {
+ pgpa_clumped_join *cjoin = lfirst(lc);
+
+ appendStringInfoChar(buf, ' ');
+ pgpa_debug_out_clumped_join(buf, cjoin, rt_identifiers);
+ }
+
+ foreach(lc, context->gathered_joins)
+ {
+ pgpa_gathered_join *gathered_join = lfirst(lc);
+
+ appendStringInfoChar(buf, ' ');
+ pgpa_debug_out_gathered_join(buf, gathered_join, rt_identifiers);
+ }
+}
+
void
pgpa_debug_out_clumped_join(StringInfo buf, pgpa_clumped_join *clump,
const char **rt_identifiers)