static void _outIndexOptInfo(StringInfo str, IndexOptInfo *node) { WRITE_NODE_TYPE("INDEXOPTINFO"); /* NB: this isn't a complete set of fields */ WRITE_OID_FIELD(indexoid); /* Do NOT print rel field, else infinite recursion */ WRITE_UINT_FIELD(pages); WRITE_FLOAT_FIELD(tuples, "%.0f"); WRITE_INT_FIELD(ncolumns); WRITE_OID_ARRAY(opfamily, node->ncolumns); WRITE_INT_ARRAY(indexkeys, node->ncolumns, int); WRITE_OID_ARRAY(fwdsortop, node->ncolumns); WRITE_OID_ARRAY(revsortop, node->ncolumns); WRITE_OID_FIELD(relam); WRITE_OID_FIELD(amcostestimate); WRITE_NODE_FIELD(indexprs); WRITE_NODE_FIELD(indpred); WRITE_BOOL_FIELD(predOK); WRITE_BOOL_FIELD(unique); WRITE_BOOL_FIELD(amoptionalkey); WRITE_BOOL_FIELD(cdb_default_stats_used); }
/* * print the basic stuff of all nodes that inherit from Plan */ static void _outPlanInfo(StringInfo str, Plan *node) { if (print_variable_fields) { WRITE_INT_FIELD(plan_node_id); WRITE_INT_FIELD(plan_parent_node_id); WRITE_FLOAT_FIELD(startup_cost, "%.2f"); WRITE_FLOAT_FIELD(total_cost, "%.2f"); WRITE_FLOAT_FIELD(plan_rows, "%.0f"); WRITE_INT_FIELD(plan_width); } WRITE_NODE_FIELD(targetlist); WRITE_NODE_FIELD(qual); WRITE_BITMAPSET_FIELD(extParam); WRITE_BITMAPSET_FIELD(allParam); WRITE_INT_FIELD(nParamExec); if (print_variable_fields) { WRITE_NODE_FIELD(flow); WRITE_INT_FIELD(dispatch); WRITE_BOOL_FIELD(directDispatch.isDirectDispatch); WRITE_NODE_FIELD(directDispatch.contentIds); WRITE_INT_FIELD(nMotionNodes); WRITE_INT_FIELD(nInitPlans); WRITE_NODE_FIELD(sliceTable); } WRITE_NODE_FIELD(lefttree); WRITE_NODE_FIELD(righttree); WRITE_NODE_FIELD(initPlan); if (print_variable_fields) { WRITE_UINT64_FIELD(operatorMemKB); } }
static void set_T_ParamPathInfo(DebugGraph *graph, DebugNode *n, PlannerInfo *root, Node *node) { ParamPathInfo *actual_node = (ParamPathInfo*) node; addRelids(n, "ppi_req_outer", root, actual_node->ppi_req_outer); WRITE_FLOAT_FIELD(ppi_rows, "%lf"); WRITE_NODE_FIELD(ppi_clauses); }
static void set_T_PlannerInfo(DebugGraph *graph, DebugNode *n, PlannerInfo *ignored, Node *node) { PlannerInfo *root = (PlannerInfo*) node; PlannerInfo *actual_node = (PlannerInfo*) node; WRITE_UINT_FIELD(query_level); WRITE_NODE_FIELD(parent_root); addRelids(n, "all_baserels", root, root->all_baserels); WRITE_NODE_FIELD(left_join_clauses); WRITE_NODE_FIELD(right_join_clauses); WRITE_NODE_FIELD(full_join_clauses); WRITE_NODE_FIELD(initial_rels); WRITE_FLOAT_FIELD(total_table_pages, "%lf"); WRITE_FLOAT_FIELD(tuple_fraction, "%lf"); WRITE_FLOAT_FIELD(limit_tuples, "%lf"); }
static void set_T_IndexPath(DebugGraph *graph, DebugNode *n, PlannerInfo *root, Node *node) { IndexPath *actual_node = (IndexPath*) node; set_T_Path(graph, n, root, node); /* inheritance */ WRITE_NODE_FIELD(indexinfo); WRITE_NODE_FIELD(indexclauses); WRITE_NODE_FIELD(indexquals); WRITE_NODE_FIELD(indexqualcols); WRITE_NODE_FIELD(indexorderbys); WRITE_NODE_FIELD(indexorderbycols); WRITE_INT_FIELD(indexscandir); { Cost indexStartupCost=0, indexTotalCost=0, indexSelectivity=0, indexCorrelation=0; int loops = 1; if (actual_node->path.param_info) loops = get_loop_count(root, actual_node->path.param_info->ppi_req_outer); if (actual_node->indexinfo) OidFunctionCall7(actual_node->indexinfo->amcostestimate, PointerGetDatum(root), PointerGetDatum(actual_node), Float8GetDatum(loops), PointerGetDatum(&indexStartupCost), PointerGetDatum(&indexTotalCost), PointerGetDatum(&indexSelectivity), PointerGetDatum(&indexCorrelation)); WRITE_CUSTOM_FIELD("indexstartupcost", "%lf", indexStartupCost); WRITE_CUSTOM_FIELD("indexcorrelation", "%le", indexCorrelation); } WRITE_FLOAT_FIELD(indextotalcost, "%lf"); WRITE_FLOAT_FIELD(indexselectivity, "%le"); }
static void set_T_RestrictInfo(DebugGraph *graph, DebugNode *n, PlannerInfo *root, Node *node) { RestrictInfo *actual_node = (RestrictInfo*) node; { const char *aux; aux = getExpr((Node *) actual_node->clause, root->parse->rtable); WRITE_CUSTOM_FIELD("clause", "%s", aux); pfree((void*)aux); aux = getExpr((Node *) actual_node->orclause, root->parse->rtable); WRITE_CUSTOM_FIELD("orclause", "%s", aux); pfree((void*)aux); } WRITE_BOOL_FIELD(is_pushed_down); WRITE_BOOL_FIELD(outerjoin_delayed); WRITE_BOOL_FIELD(can_join); WRITE_BOOL_FIELD(pseudoconstant); WRITE_FLOAT_FIELD(eval_cost.startup, "%lf"); WRITE_FLOAT_FIELD(eval_cost.per_tuple, "%lf"); WRITE_FLOAT_FIELD(norm_selec, "%lf"); WRITE_FLOAT_FIELD(outer_selec, "%lf"); }
static void set_T_RelOptInfo(DebugGraph *graph, DebugNode *n, PlannerInfo *root, Node *node) { RelOptInfo *actual_node = (RelOptInfo*) node; addRelids(n, "relids", root, actual_node->relids); WRITE_FLOAT_FIELD(rows, "%lf"); WRITE_INT_FIELD(width); # if PG_VERSION_NUM/100 >= 903 addRelids(n, "lateral_relids", root, actual_node->lateral_relids); WRITE_BOOL_FIELD(consider_startup); # endif WRITE_UINT_FIELD(relid); newDebugEdgeByNode(graph, n, getTablespace(graph, actual_node->reltablespace), "reltablespace"); WRITE_INT_FIELD(rtekind); WRITE_FLOAT_FIELD(tuples, "%lf"); WRITE_FLOAT_FIELD(allvisfrac, "%lf"); WRITE_UINT_FIELD(pages); WRITE_NODE_FIELD(pathlist); WRITE_NODE_FIELD(cheapest_startup_path); WRITE_NODE_FIELD(cheapest_total_path); WRITE_NODE_FIELD(baserestrictinfo); WRITE_FLOAT_FIELD(baserestrictcost.startup, "%lf"); WRITE_FLOAT_FIELD(baserestrictcost.per_tuple, "%lf"); WRITE_NODE_FIELD(joininfo); WRITE_BOOL_FIELD(has_eclass_joins); /* pseudo attribute. Is there more than one root per reloptinfo? */ newDebugEdgeByNode(graph, n, getNode(graph, root, (Node*)root), "_root"); }