diff --git a/contrib/postgres_fdw/expected/postgres_fdw.out b/contrib/postgres_fdw/expected/postgres_fdw.out index 2927a9c7db..02e19828b5 100644 --- a/contrib/postgres_fdw/expected/postgres_fdw.out +++ b/contrib/postgres_fdw/expected/postgres_fdw.out @@ -7094,10 +7094,10 @@ select * from bar where f1 in (select f1 from foo) for update; Inner Unique: true Hash Cond: (bar.f1 = foo.f1) -> Append - -> Seq Scan on public.bar - Output: bar.f1, bar.f2, bar.ctid, bar.*, bar.tableoid - -> Foreign Scan on public.bar2 bar_1 + -> Seq Scan on public.bar bar_1 Output: bar_1.f1, bar_1.f2, bar_1.ctid, bar_1.*, bar_1.tableoid + -> Foreign Scan on public.bar2 bar_2 + Output: bar_2.f1, bar_2.f2, bar_2.ctid, bar_2.*, bar_2.tableoid Remote SQL: SELECT f1, f2, f3, ctid FROM public.loct2 FOR UPDATE -> Hash Output: foo.ctid, foo.f1, foo.*, foo.tableoid @@ -7105,10 +7105,10 @@ select * from bar where f1 in (select f1 from foo) for update; Output: foo.ctid, foo.f1, foo.*, foo.tableoid Group Key: foo.f1 -> Append - -> Seq Scan on public.foo - Output: foo.ctid, foo.f1, foo.*, foo.tableoid - -> Foreign Scan on public.foo2 foo_1 + -> Seq Scan on public.foo foo_1 Output: foo_1.ctid, foo_1.f1, foo_1.*, foo_1.tableoid + -> Foreign Scan on public.foo2 foo_2 + Output: foo_2.ctid, foo_2.f1, foo_2.*, foo_2.tableoid Remote SQL: SELECT f1, f2, f3, ctid FROM public.loct1 (23 rows) @@ -7132,10 +7132,10 @@ select * from bar where f1 in (select f1 from foo) for share; Inner Unique: true Hash Cond: (bar.f1 = foo.f1) -> Append - -> Seq Scan on public.bar - Output: bar.f1, bar.f2, bar.ctid, bar.*, bar.tableoid - -> Foreign Scan on public.bar2 bar_1 + -> Seq Scan on public.bar bar_1 Output: bar_1.f1, bar_1.f2, bar_1.ctid, bar_1.*, bar_1.tableoid + -> Foreign Scan on public.bar2 bar_2 + Output: bar_2.f1, bar_2.f2, bar_2.ctid, bar_2.*, bar_2.tableoid Remote SQL: SELECT f1, f2, f3, ctid FROM public.loct2 FOR SHARE -> Hash Output: foo.ctid, foo.f1, foo.*, foo.tableoid @@ -7143,10 +7143,10 @@ select * from bar where f1 in (select f1 from foo) for share; Output: foo.ctid, foo.f1, foo.*, foo.tableoid Group Key: foo.f1 -> Append - -> Seq Scan on public.foo - Output: foo.ctid, foo.f1, foo.*, foo.tableoid - -> Foreign Scan on public.foo2 foo_1 + -> Seq Scan on public.foo foo_1 Output: foo_1.ctid, foo_1.f1, foo_1.*, foo_1.tableoid + -> Foreign Scan on public.foo2 foo_2 + Output: foo_2.ctid, foo_2.f1, foo_2.*, foo_2.tableoid Remote SQL: SELECT f1, f2, f3, ctid FROM public.loct1 (23 rows) @@ -7180,10 +7180,10 @@ update bar set f2 = f2 + 100 where f1 in (select f1 from foo); Output: foo.ctid, foo.f1, foo.*, foo.tableoid Group Key: foo.f1 -> Append - -> Seq Scan on public.foo - Output: foo.ctid, foo.f1, foo.*, foo.tableoid - -> Foreign Scan on public.foo2 foo_1 + -> Seq Scan on public.foo foo_1 Output: foo_1.ctid, foo_1.f1, foo_1.*, foo_1.tableoid + -> Foreign Scan on public.foo2 foo_2 + Output: foo_2.ctid, foo_2.f1, foo_2.*, foo_2.tableoid Remote SQL: SELECT f1, f2, f3, ctid FROM public.loct1 -> Hash Join Output: bar_1.f1, (bar_1.f2 + 100), bar_1.f3, bar_1.ctid, foo.ctid, foo.*, foo.tableoid @@ -7198,10 +7198,10 @@ update bar set f2 = f2 + 100 where f1 in (select f1 from foo); Output: foo.ctid, foo.f1, foo.*, foo.tableoid Group Key: foo.f1 -> Append - -> Seq Scan on public.foo - Output: foo.ctid, foo.f1, foo.*, foo.tableoid - -> Foreign Scan on public.foo2 foo_1 + -> Seq Scan on public.foo foo_1 Output: foo_1.ctid, foo_1.f1, foo_1.*, foo_1.tableoid + -> Foreign Scan on public.foo2 foo_2 + Output: foo_2.ctid, foo_2.f1, foo_2.*, foo_2.tableoid Remote SQL: SELECT f1, f2, f3, ctid FROM public.loct1 (39 rows) @@ -7316,10 +7316,10 @@ explain (verbose, costs off) Merge Cond: (foo.f1 = loct1.f1) -> Merge Append Sort Key: foo.f1 - -> Index Scan using i_foo_f1 on public.foo - Output: foo.f1, foo.f2 - -> Foreign Scan on public.foo2 foo_1 + -> Index Scan using i_foo_f1 on public.foo foo_1 Output: foo_1.f1, foo_1.f2 + -> Foreign Scan on public.foo2 foo_2 + Output: foo_2.f1, foo_2.f2 Remote SQL: SELECT f1, f2 FROM public.loct1 ORDER BY f1 ASC NULLS LAST -> Index Only Scan using i_loct1_f1 on public.loct1 Output: loct1.f1 @@ -7356,10 +7356,10 @@ explain (verbose, costs off) Merge Cond: (foo.f1 = loct1.f1) -> Merge Append Sort Key: foo.f1 - -> Index Scan using i_foo_f1 on public.foo - Output: foo.f1, foo.f2 - -> Foreign Scan on public.foo2 foo_1 + -> Index Scan using i_foo_f1 on public.foo foo_1 Output: foo_1.f1, foo_1.f2 + -> Foreign Scan on public.foo2 foo_2 + Output: foo_2.f1, foo_2.f2 Remote SQL: SELECT f1, f2 FROM public.loct1 ORDER BY f1 ASC NULLS LAST -> Index Only Scan using i_loct1_f1 on public.loct1 Output: loct1.f1 @@ -8516,9 +8516,9 @@ SELECT t1.a,t2.b,t3.c FROM fprt1 t1 INNER JOIN fprt2 t2 ON (t1.a = t2.b) INNER J Sort Key: t1.a, t3.c -> Append -> Foreign Scan - Relations: ((ftprt1_p1 t1) INNER JOIN (ftprt2_p1 t2)) INNER JOIN (ftprt1_p1 t3) + Relations: ((ftprt1_p1 t1_1) INNER JOIN (ftprt2_p1 t2_1)) INNER JOIN (ftprt1_p1 t3_1) -> Foreign Scan - Relations: ((ftprt1_p2 t1_1) INNER JOIN (ftprt2_p2 t2_1)) INNER JOIN (ftprt1_p2 t3_1) + Relations: ((ftprt1_p2 t1_2) INNER JOIN (ftprt2_p2 t2_2)) INNER JOIN (ftprt1_p2 t3_2) (7 rows) SELECT t1.a,t2.b,t3.c FROM fprt1 t1 INNER JOIN fprt2 t2 ON (t1.a = t2.b) INNER JOIN fprt1 t3 ON (t2.b = t3.a) WHERE t1.a % 25 =0 ORDER BY 1,2,3; @@ -8561,12 +8561,12 @@ SELECT t1.wr, t2.wr FROM (SELECT t1 wr, a FROM fprt1 t1 WHERE t1.a % 25 = 0) t1 -> Hash Full Join Hash Cond: (t1.a = t2.b) -> Append - -> Foreign Scan on ftprt1_p1 t1 - -> Foreign Scan on ftprt1_p2 t1_1 + -> Foreign Scan on ftprt1_p1 t1_1 + -> Foreign Scan on ftprt1_p2 t1_2 -> Hash -> Append - -> Foreign Scan on ftprt2_p1 t2 - -> Foreign Scan on ftprt2_p2 t2_1 + -> Foreign Scan on ftprt2_p1 t2_1 + -> Foreign Scan on ftprt2_p2 t2_2 (11 rows) SELECT t1.wr, t2.wr FROM (SELECT t1 wr, a FROM fprt1 t1 WHERE t1.a % 25 = 0) t1 FULL JOIN (SELECT t2 wr, b FROM fprt2 t2 WHERE t2.b % 25 = 0) t2 ON (t1.a = t2.b) ORDER BY 1,2; @@ -8597,9 +8597,9 @@ SELECT t1.a,t1.b FROM fprt1 t1, LATERAL (SELECT t2.a, t2.b FROM fprt2 t2 WHERE t Sort Key: t1.a, t1.b -> Append -> Foreign Scan - Relations: (ftprt1_p1 t1) INNER JOIN (ftprt2_p1 t2) + Relations: (ftprt1_p1 t1_1) INNER JOIN (ftprt2_p1 t2_1) -> Foreign Scan - Relations: (ftprt1_p2 t1_1) INNER JOIN (ftprt2_p2 t2_1) + Relations: (ftprt1_p2 t1_2) INNER JOIN (ftprt2_p2 t2_2) (7 rows) SELECT t1.a,t1.b FROM fprt1 t1, LATERAL (SELECT t2.a, t2.b FROM fprt2 t2 WHERE t1.a = t2.b AND t1.b = t2.a) q WHERE t1.a%25 = 0 ORDER BY 1,2; @@ -8619,16 +8619,16 @@ SELECT t1.a, t1.phv, t2.b, t2.phv FROM (SELECT 't1_phv' phv, * FROM fprt1 WHERE Sort Sort Key: fprt1.a, fprt2.b -> Append - -> Hash Full Join - Hash Cond: (fprt1.a = fprt2.b) - -> Foreign Scan on ftprt1_p1 fprt1 - -> Hash - -> Foreign Scan on ftprt2_p1 fprt2 -> Hash Full Join Hash Cond: (fprt1_1.a = fprt2_1.b) - -> Foreign Scan on ftprt1_p2 fprt1_1 + -> Foreign Scan on ftprt1_p1 fprt1_1 -> Hash - -> Foreign Scan on ftprt2_p2 fprt2_1 + -> Foreign Scan on ftprt2_p1 fprt2_1 + -> Hash Full Join + Hash Cond: (fprt1_2.a = fprt2_2.b) + -> Foreign Scan on ftprt1_p2 fprt1_2 + -> Hash + -> Foreign Scan on ftprt2_p2 fprt2_2 (13 rows) SELECT t1.a, t1.phv, t2.b, t2.phv FROM (SELECT 't1_phv' phv, * FROM fprt1 WHERE a % 25 = 0) t1 FULL JOIN (SELECT 't2_phv' phv, * FROM fprt2 WHERE b % 25 = 0) t2 ON (t1.a = t2.b) ORDER BY t1.a, t2.b; @@ -8661,12 +8661,12 @@ SELECT t1.a, t2.b FROM fprt1 t1 INNER JOIN fprt2 t2 ON (t1.a = t2.b) WHERE t1.a -> Hash Join Hash Cond: (t2.b = t1.a) -> Append - -> Foreign Scan on ftprt2_p1 t2 - -> Foreign Scan on ftprt2_p2 t2_1 + -> Foreign Scan on ftprt2_p1 t2_1 + -> Foreign Scan on ftprt2_p2 t2_2 -> Hash -> Append - -> Foreign Scan on ftprt1_p1 t1 - -> Foreign Scan on ftprt1_p2 t1_1 + -> Foreign Scan on ftprt1_p1 t1_1 + -> Foreign Scan on ftprt1_p2 t1_2 (12 rows) SELECT t1.a, t2.b FROM fprt1 t1 INNER JOIN fprt2 t2 ON (t1.a = t2.b) WHERE t1.a % 25 = 0 ORDER BY 1,2 FOR UPDATE OF t1; @@ -8710,9 +8710,9 @@ SELECT a, sum(b), min(b), count(*) FROM pagg_tab GROUP BY a HAVING avg(b) < 22 O Group Key: pagg_tab.a Filter: (avg(pagg_tab.b) < '22'::numeric) -> Append - -> Foreign Scan on fpagg_tab_p1 pagg_tab - -> Foreign Scan on fpagg_tab_p2 pagg_tab_1 - -> Foreign Scan on fpagg_tab_p3 pagg_tab_2 + -> Foreign Scan on fpagg_tab_p1 pagg_tab_1 + -> Foreign Scan on fpagg_tab_p2 pagg_tab_2 + -> Foreign Scan on fpagg_tab_p3 pagg_tab_3 (9 rows) -- Plan with partitionwise aggregates is enabled diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c index 62fb3434a3..7ae5a42e45 100644 --- a/src/backend/commands/explain.c +++ b/src/backend/commands/explain.c @@ -689,8 +689,8 @@ ExplainPrintPlan(ExplainState *es, QueryDesc *queryDesc) es->rtable = queryDesc->plannedstmt->rtable; ExplainPreScanNode(queryDesc->planstate, &rels_used); es->rtable_names = select_rtable_names_for_explain(es->rtable, rels_used); - es->deparse_cxt = deparse_context_for_plan_rtable(es->rtable, - es->rtable_names); + es->deparse_cxt = deparse_context_for_plan_tree(queryDesc->plannedstmt, + es->rtable_names); es->printed_subplans = NULL; /* @@ -1034,6 +1034,14 @@ ExplainPreScanNode(PlanState *planstate, Bitmapset **rels_used) *rels_used = bms_add_member(*rels_used, ((ModifyTable *) plan)->exclRelRTI); break; + case T_Append: + *rels_used = bms_add_members(*rels_used, + ((Append *) plan)->apprelids); + break; + case T_MergeAppend: + *rels_used = bms_add_members(*rels_used, + ((MergeAppend *) plan)->apprelids); + break; default: break; } @@ -1049,8 +1057,8 @@ ExplainPreScanNode(PlanState *planstate, Bitmapset **rels_used) * We need to work from a PlanState node, not just a Plan node, in order to * get at the instrumentation data (if any) as well as the list of subplans. * - * ancestors is a list of parent PlanState nodes, most-closely-nested first. - * These are needed in order to interpret PARAM_EXEC Params. + * ancestors is a list of parent Plan and SubPlan nodes, most-closely-nested + * first. These are needed in order to interpret PARAM_EXEC Params. * * relationship describes the relationship of this plan node to its parent * (eg, "Outer", "Inner"); it can be null at top level. plan_name is an @@ -1953,8 +1961,8 @@ ExplainNode(PlanState *planstate, List *ancestors, if (haschildren) { ExplainOpenGroup("Plans", "Plans", false, es); - /* Pass current PlanState as head of ancestors list for children */ - ancestors = lcons(planstate, ancestors); + /* Pass current Plan as head of ancestors list for children */ + ancestors = lcons(plan, ancestors); } /* initPlan-s */ @@ -2075,9 +2083,9 @@ show_plan_tlist(PlanState *planstate, List *ancestors, ExplainState *es) return; /* Set up deparsing context */ - context = set_deparse_context_planstate(es->deparse_cxt, - (Node *) planstate, - ancestors); + context = set_deparse_context_plan(es->deparse_cxt, + plan, + ancestors); useprefix = list_length(es->rtable) > 1; /* Deparse each result column (we now include resjunk ones) */ @@ -2106,9 +2114,9 @@ show_expression(Node *node, const char *qlabel, char *exprstr; /* Set up deparsing context */ - context = set_deparse_context_planstate(es->deparse_cxt, - (Node *) planstate, - ancestors); + context = set_deparse_context_plan(es->deparse_cxt, + planstate->plan, + ancestors); /* Deparse the expression */ exprstr = deparse_expression(node, context, useprefix, false); @@ -2209,7 +2217,7 @@ show_agg_keys(AggState *astate, List *ancestors, if (plan->numCols > 0 || plan->groupingSets) { /* The key columns refer to the tlist of the child plan */ - ancestors = lcons(astate, ancestors); + ancestors = lcons(plan, ancestors); if (plan->groupingSets) show_grouping_sets(outerPlanState(astate), plan, ancestors, es); @@ -2232,9 +2240,9 @@ show_grouping_sets(PlanState *planstate, Agg *agg, ListCell *lc; /* Set up deparsing context */ - context = set_deparse_context_planstate(es->deparse_cxt, - (Node *) planstate, - ancestors); + context = set_deparse_context_plan(es->deparse_cxt, + planstate->plan, + ancestors); useprefix = (list_length(es->rtable) > 1 || es->verbose); ExplainOpenGroup("Grouping Sets", "Grouping Sets", false, es); @@ -2339,7 +2347,7 @@ show_group_keys(GroupState *gstate, List *ancestors, Group *plan = (Group *) gstate->ss.ps.plan; /* The key columns refer to the tlist of the child plan */ - ancestors = lcons(gstate, ancestors); + ancestors = lcons(plan, ancestors); show_sort_group_keys(outerPlanState(gstate), "Group Key", plan->numCols, plan->grpColIdx, NULL, NULL, NULL, @@ -2371,9 +2379,9 @@ show_sort_group_keys(PlanState *planstate, const char *qlabel, initStringInfo(&sortkeybuf); /* Set up deparsing context */ - context = set_deparse_context_planstate(es->deparse_cxt, - (Node *) planstate, - ancestors); + context = set_deparse_context_plan(es->deparse_cxt, + plan, + ancestors); useprefix = (list_length(es->rtable) > 1 || es->verbose); for (keyno = 0; keyno < nkeys; keyno++) @@ -2479,9 +2487,9 @@ show_tablesample(TableSampleClause *tsc, PlanState *planstate, ListCell *lc; /* Set up deparsing context */ - context = set_deparse_context_planstate(es->deparse_cxt, - (Node *) planstate, - ancestors); + context = set_deparse_context_plan(es->deparse_cxt, + planstate->plan, + ancestors); useprefix = list_length(es->rtable) > 1; /* Get the tablesample method name */ @@ -3344,7 +3352,7 @@ ExplainMemberNodes(PlanState **planstates, int nsubnodes, int nplans, * Explain a list of SubPlans (or initPlans, which also use SubPlan nodes). * * The ancestors list should already contain the immediate parent of these - * SubPlanStates. + * SubPlans. */ static void ExplainSubPlans(List *plans, List *ancestors, @@ -3372,8 +3380,17 @@ ExplainSubPlans(List *plans, List *ancestors, es->printed_subplans = bms_add_member(es->printed_subplans, sp->plan_id); + /* + * Treat the SubPlan node as an ancestor of the plan node(s) within + * it, so that ruleutils.c can find the referents of subplan + * parameters. + */ + ancestors = lcons(sp, ancestors); + ExplainNode(sps->planstate, ancestors, relationship, sp->plan_name, es); + + ancestors = list_delete_first(ancestors); } } diff --git a/src/backend/executor/execParallel.c b/src/backend/executor/execParallel.c index b256642665..683b06cdd6 100644 --- a/src/backend/executor/execParallel.c +++ b/src/backend/executor/execParallel.c @@ -181,6 +181,8 @@ ExecSerializePlan(Plan *plan, EState *estate) pstmt->planTree = plan; pstmt->rtable = estate->es_range_table; pstmt->resultRelations = NIL; + pstmt->rootResultRelations = NIL; + pstmt->appendRelations = NIL; /* * Transfer only parallel-safe subplans, leaving a NULL "hole" in the list diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index e3eb9d7b90..9ba1d78344 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2526,9 +2526,6 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags) econtext = mtstate->ps.ps_ExprContext; relationDesc = resultRelInfo->ri_RelationDesc->rd_att; - /* carried forward solely for the benefit of explain */ - mtstate->mt_excludedtlist = node->exclRelTlist; - /* create state for DO UPDATE SET operation */ resultRelInfo->ri_onConflict = makeNode(OnConflictSetState); diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c index a74b56bb59..a9b8b84b8f 100644 --- a/src/backend/nodes/copyfuncs.c +++ b/src/backend/nodes/copyfuncs.c @@ -92,6 +92,7 @@ _copyPlannedStmt(const PlannedStmt *from) COPY_NODE_FIELD(rtable); COPY_NODE_FIELD(resultRelations); COPY_NODE_FIELD(rootResultRelations); + COPY_NODE_FIELD(appendRelations); COPY_NODE_FIELD(subplans); COPY_BITMAPSET_FIELD(rewindPlanIDs); COPY_NODE_FIELD(rowMarks); @@ -241,6 +242,7 @@ _copyAppend(const Append *from) /* * copy remainder of node */ + COPY_BITMAPSET_FIELD(apprelids); COPY_NODE_FIELD(appendplans); COPY_SCALAR_FIELD(first_partial_plan); COPY_NODE_FIELD(part_prune_info); @@ -264,6 +266,7 @@ _copyMergeAppend(const MergeAppend *from) /* * copy remainder of node */ + COPY_BITMAPSET_FIELD(apprelids); COPY_NODE_FIELD(mergeplans); COPY_SCALAR_FIELD(numCols); COPY_POINTER_FIELD(sortColIdx, from->numCols * sizeof(AttrNumber)); diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c index a80eccc2c1..ac02e5ec8d 100644 --- a/src/backend/nodes/outfuncs.c +++ b/src/backend/nodes/outfuncs.c @@ -310,6 +310,7 @@ _outPlannedStmt(StringInfo str, const PlannedStmt *node) WRITE_NODE_FIELD(rtable); WRITE_NODE_FIELD(resultRelations); WRITE_NODE_FIELD(rootResultRelations); + WRITE_NODE_FIELD(appendRelations); WRITE_NODE_FIELD(subplans); WRITE_BITMAPSET_FIELD(rewindPlanIDs); WRITE_NODE_FIELD(rowMarks); @@ -431,6 +432,7 @@ _outAppend(StringInfo str, const Append *node) _outPlanInfo(str, (const Plan *) node); + WRITE_BITMAPSET_FIELD(apprelids); WRITE_NODE_FIELD(appendplans); WRITE_INT_FIELD(first_partial_plan); WRITE_NODE_FIELD(part_prune_info); @@ -443,6 +445,7 @@ _outMergeAppend(StringInfo str, const MergeAppend *node) _outPlanInfo(str, (const Plan *) node); + WRITE_BITMAPSET_FIELD(apprelids); WRITE_NODE_FIELD(mergeplans); WRITE_INT_FIELD(numCols); WRITE_ATTRNUMBER_ARRAY(sortColIdx, node->numCols); @@ -2167,6 +2170,7 @@ _outPlannerGlobal(StringInfo str, const PlannerGlobal *node) WRITE_NODE_FIELD(finalrowmarks); WRITE_NODE_FIELD(resultRelations); WRITE_NODE_FIELD(rootResultRelations); + WRITE_NODE_FIELD(appendRelations); WRITE_NODE_FIELD(relationOids); WRITE_NODE_FIELD(invalItems); WRITE_NODE_FIELD(paramExecTypes); diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c index 764e3bb90c..93ea4280d2 100644 --- a/src/backend/nodes/readfuncs.c +++ b/src/backend/nodes/readfuncs.c @@ -1512,6 +1512,7 @@ _readPlannedStmt(void) READ_NODE_FIELD(rtable); READ_NODE_FIELD(resultRelations); READ_NODE_FIELD(rootResultRelations); + READ_NODE_FIELD(appendRelations); READ_NODE_FIELD(subplans); READ_BITMAPSET_FIELD(rewindPlanIDs); READ_NODE_FIELD(rowMarks); @@ -1636,6 +1637,7 @@ _readAppend(void) ReadCommonPlan(&local_node->plan); + READ_BITMAPSET_FIELD(apprelids); READ_NODE_FIELD(appendplans); READ_INT_FIELD(first_partial_plan); READ_NODE_FIELD(part_prune_info); @@ -1653,6 +1655,7 @@ _readMergeAppend(void) ReadCommonPlan(&local_node->plan); + READ_BITMAPSET_FIELD(apprelids); READ_NODE_FIELD(mergeplans); READ_INT_FIELD(numCols); READ_ATTRNUMBER_ARRAY(sortColIdx, local_node->numCols); diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c index aee81bd755..8c8b4f8ed6 100644 --- a/src/backend/optimizer/plan/createplan.c +++ b/src/backend/optimizer/plan/createplan.c @@ -1118,6 +1118,7 @@ create_append_plan(PlannerInfo *root, AppendPath *best_path, int flags) plan->plan.qual = NIL; plan->plan.lefttree = NULL; plan->plan.righttree = NULL; + plan->apprelids = rel->relids; if (pathkeys != NIL) { @@ -1295,6 +1296,7 @@ create_merge_append_plan(PlannerInfo *root, MergeAppendPath *best_path, plan->qual = NIL; plan->lefttree = NULL; plan->righttree = NULL; + node->apprelids = rel->relids; /* * Compute sort column info, and adjust MergeAppend's tlist as needed. diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c index 7fe11b59a0..cb54b15507 100644 --- a/src/backend/optimizer/plan/planner.c +++ b/src/backend/optimizer/plan/planner.c @@ -304,6 +304,7 @@ standard_planner(Query *parse, int cursorOptions, ParamListInfo boundParams) glob->finalrowmarks = NIL; glob->resultRelations = NIL; glob->rootResultRelations = NIL; + glob->appendRelations = NIL; glob->relationOids = NIL; glob->invalItems = NIL; glob->paramExecTypes = NIL; @@ -494,6 +495,7 @@ standard_planner(Query *parse, int cursorOptions, ParamListInfo boundParams) Assert(glob->finalrowmarks == NIL); Assert(glob->resultRelations == NIL); Assert(glob->rootResultRelations == NIL); + Assert(glob->appendRelations == NIL); top_plan = set_plan_references(root, top_plan); /* ... and the subplans (both regular subplans and initplans) */ Assert(list_length(glob->subplans) == list_length(glob->subroots)); @@ -520,6 +522,7 @@ standard_planner(Query *parse, int cursorOptions, ParamListInfo boundParams) result->rtable = glob->finalrtable; result->resultRelations = glob->resultRelations; result->rootResultRelations = glob->rootResultRelations; + result->appendRelations = glob->appendRelations; result->subplans = glob->subplans; result->rewindPlanIDs = glob->rewindPlanIDs; result->rowMarks = glob->finalrowmarks; @@ -1219,6 +1222,7 @@ inheritance_planner(PlannerInfo *root) Index rootRelation = 0; List *final_rtable = NIL; List *final_rowmarks = NIL; + List *final_appendrels = NIL; int save_rel_array_size = 0; RelOptInfo **save_rel_array = NULL; AppendRelInfo **save_append_rel_array = NULL; @@ -1627,12 +1631,13 @@ inheritance_planner(PlannerInfo *root) * modified subquery RTEs into final_rtable, to ensure we have sane * copies of those. Also save the first non-excluded child's version * of the rowmarks list; we assume all children will end up with - * equivalent versions of that. + * equivalent versions of that. Likewise for append_rel_list. */ if (final_rtable == NIL) { final_rtable = subroot->parse->rtable; final_rowmarks = subroot->rowMarks; + final_appendrels = subroot->append_rel_list; } else { @@ -1764,8 +1769,9 @@ inheritance_planner(PlannerInfo *root) root->simple_rte_array[rti++] = rte; } - /* Put back adjusted rowmarks, too */ + /* Put back adjusted rowmarks and appendrels, too */ root->rowMarks = final_rowmarks; + root->append_rel_list = final_appendrels; } /* diff --git a/src/backend/optimizer/plan/setrefs.c b/src/backend/optimizer/plan/setrefs.c index 566ee96da8..f581c5f532 100644 --- a/src/backend/optimizer/plan/setrefs.c +++ b/src/backend/optimizer/plan/setrefs.c @@ -108,6 +108,7 @@ static Plan *set_mergeappend_references(PlannerInfo *root, MergeAppend *mplan, int rtoffset); static void set_hash_references(PlannerInfo *root, Plan *plan, int rtoffset); +static Relids offset_relid_set(Relids relids, int rtoffset); static Node *fix_scan_expr(PlannerInfo *root, Node *node, int rtoffset); static Node *fix_scan_expr_mutator(Node *node, fix_scan_expr_context *context); static bool fix_scan_expr_walker(Node *node, fix_scan_expr_context *context); @@ -208,7 +209,8 @@ static List *set_returning_clause_references(PlannerInfo *root, * * The flattened rangetable entries are appended to root->glob->finalrtable. * Also, rowmarks entries are appended to root->glob->finalrowmarks, and the - * RT indexes of ModifyTable result relations to root->glob->resultRelations. + * RT indexes of ModifyTable result relations to root->glob->resultRelations, + * and flattened AppendRelInfos are appended to root->glob->appendRelations. * Plan dependencies are appended to root->glob->relationOids (for relations) * and root->glob->invalItems (for everything else). * @@ -250,6 +252,28 @@ set_plan_references(PlannerInfo *root, Plan *plan) glob->finalrowmarks = lappend(glob->finalrowmarks, newrc); } + /* + * Adjust RT indexes of AppendRelInfos and add to final appendrels list. + * We assume the AppendRelInfos were built during planning and don't need + * to be copied. + */ + foreach(lc, root->append_rel_list) + { + AppendRelInfo *appinfo = lfirst_node(AppendRelInfo, lc); + + /* adjust RT indexes */ + appinfo->parent_relid += rtoffset; + appinfo->child_relid += rtoffset; + + /* + * Rather than adjust the translated_vars entries, just drop 'em. + * Neither the executor nor EXPLAIN currently need that data. + */ + appinfo->translated_vars = NIL; + + glob->appendRelations = lappend(glob->appendRelations, appinfo); + } + /* Now fix the Plan tree */ return set_plan_refs(root, plan, rtoffset); } @@ -1215,16 +1239,7 @@ set_foreignscan_references(PlannerInfo *root, fix_scan_list(root, fscan->fdw_recheck_quals, rtoffset); } - /* Adjust fs_relids if needed */ - if (rtoffset > 0) - { - Bitmapset *tempset = NULL; - int x = -1; - - while ((x = bms_next_member(fscan->fs_relids, x)) >= 0) - tempset = bms_add_member(tempset, x + rtoffset); - fscan->fs_relids = tempset; - } + fscan->fs_relids = offset_relid_set(fscan->fs_relids, rtoffset); } /* @@ -1287,16 +1302,7 @@ set_customscan_references(PlannerInfo *root, lfirst(lc) = set_plan_refs(root, (Plan *) lfirst(lc), rtoffset); } - /* Adjust custom_relids if needed */ - if (rtoffset > 0) - { - Bitmapset *tempset = NULL; - int x = -1; - - while ((x = bms_next_member(cscan->custom_relids, x)) >= 0) - tempset = bms_add_member(tempset, x + rtoffset); - cscan->custom_relids = tempset; - } + cscan->custom_relids = offset_relid_set(cscan->custom_relids, rtoffset); } /* @@ -1338,6 +1344,8 @@ set_append_references(PlannerInfo *root, */ set_dummy_tlist_references((Plan *) aplan, rtoffset); + aplan->apprelids = offset_relid_set(aplan->apprelids, rtoffset); + if (aplan->part_prune_info) { foreach(l, aplan->part_prune_info->prune_infos) @@ -1400,6 +1408,8 @@ set_mergeappend_references(PlannerInfo *root, */ set_dummy_tlist_references((Plan *) mplan, rtoffset); + mplan->apprelids = offset_relid_set(mplan->apprelids, rtoffset); + if (mplan->part_prune_info) { foreach(l, mplan->part_prune_info->prune_infos) @@ -1454,6 +1464,25 @@ set_hash_references(PlannerInfo *root, Plan *plan, int rtoffset) Assert(plan->qual == NIL); } +/* + * offset_relid_set + * Apply rtoffset to the members of a Relids set. + */ +static Relids +offset_relid_set(Relids relids, int rtoffset) +{ + Relids result = NULL; + int rtindex; + + /* If there's no offset to apply, we needn't recompute the value */ + if (rtoffset == 0) + return relids; + rtindex = -1; + while ((rtindex = bms_next_member(relids, rtindex)) >= 0) + result = bms_add_member(result, rtindex + rtoffset); + return result; +} + /* * copyVar * Copy a Var node. diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c index 13685a0a0e..4af1603e7c 100644 --- a/src/backend/utils/adt/ruleutils.c +++ b/src/backend/utils/adt/ruleutils.c @@ -49,6 +49,7 @@ #include "miscadmin.h" #include "nodes/makefuncs.h" #include "nodes/nodeFuncs.h" +#include "nodes/pathnodes.h" #include "optimizer/optimizer.h" #include "parser/parse_agg.h" #include "parser/parse_func.h" @@ -118,6 +119,8 @@ typedef struct bool varprefix; /* true to print prefixes on Vars */ ParseExprKind special_exprkind; /* set only for exprkinds needing special * handling */ + Bitmapset *appendparents; /* if not null, map child Vars of these relids + * back to the parent rel */ } deparse_context; /* @@ -125,13 +128,18 @@ typedef struct * A Var having varlevelsup=N refers to the N'th item (counting from 0) in * the current context's namespaces list. * - * The rangetable is the list of actual RTEs from the query tree, and the - * cte list is the list of actual CTEs. - * + * rtable is the list of actual RTEs from the Query or PlannedStmt. * rtable_names holds the alias name to be used for each RTE (either a C * string, or NULL for nameless RTEs such as unnamed joins). * rtable_columns holds the column alias names to be used for each RTE. * + * subplans is a list of Plan trees for SubPlans and CTEs (it's only used + * in the PlannedStmt case). + * ctes is a list of CommonTableExpr nodes (only used in the Query case). + * appendrels, if not null (it's only used in the PlannedStmt case), is an + * array of AppendRelInfo nodes, indexed by child relid. We use that to map + * child-table Vars to their inheritance parents. + * * In some cases we need to make names of merged JOIN USING columns unique * across the whole query, not only per-RTE. If so, unique_using is true * and using_names is a list of C strings representing names already assigned @@ -139,28 +147,30 @@ typedef struct * * When deparsing plan trees, there is always just a single item in the * deparse_namespace list (since a plan tree never contains Vars with - * varlevelsup > 0). We store the PlanState node that is the immediate + * varlevelsup > 0). We store the Plan node that is the immediate * parent of the expression to be deparsed, as well as a list of that - * PlanState's ancestors. In addition, we store its outer and inner subplan - * state nodes, as well as their plan nodes' targetlists, and the index tlist - * if the current plan node might contain INDEX_VAR Vars. (These fields could - * be derived on-the-fly from the current PlanState, but it seems notationally - * clearer to set them up as separate fields.) + * Plan's ancestors. In addition, we store its outer and inner subplan nodes, + * as well as their targetlists, and the index tlist if the current plan node + * might contain INDEX_VAR Vars. (These fields could be derived on-the-fly + * from the current Plan node, but it seems notationally clearer to set them + * up as separate fields.) */ typedef struct { List *rtable; /* List of RangeTblEntry nodes */ List *rtable_names; /* Parallel list of names for RTEs */ List *rtable_columns; /* Parallel list of deparse_columns structs */ + List *subplans; /* List of Plan trees for SubPlans */ List *ctes; /* List of CommonTableExpr nodes */ + AppendRelInfo **appendrels; /* Array of AppendRelInfo nodes, or NULL */ /* Workspace for column alias assignment: */ bool unique_using; /* Are we making USING names globally unique */ List *using_names; /* List of assigned names for USING columns */ /* Remaining fields are used only when deparsing a Plan tree: */ - PlanState *planstate; /* immediate parent of current expression */ - List *ancestors; /* ancestors of planstate */ - PlanState *outer_planstate; /* outer subplan state, or NULL if none */ - PlanState *inner_planstate; /* inner subplan state, or NULL if none */ + Plan *plan; /* immediate parent of current expression */ + List *ancestors; /* ancestors of plan */ + Plan *outer_plan; /* outer subnode, or NULL if none */ + Plan *inner_plan; /* inner subnode, or NULL if none */ List *outer_tlist; /* referent for OUTER_VAR Vars */ List *inner_tlist; /* referent for INNER_VAR Vars */ List *index_tlist; /* referent for INDEX_VAR Vars */ @@ -287,6 +297,10 @@ typedef struct int counter; /* Largest addition used so far for name */ } NameHashEntry; +/* Callback signature for resolve_special_varno() */ +typedef void (*rsv_callback) (Node *node, deparse_context *context, + void *callback_arg); + /* ---------- * Global data @@ -357,8 +371,8 @@ static void identify_join_columns(JoinExpr *j, RangeTblEntry *jrte, static void flatten_join_using_qual(Node *qual, List **leftvars, List **rightvars); static char *get_rtable_name(int rtindex, deparse_context *context); -static void set_deparse_planstate(deparse_namespace *dpns, PlanState *ps); -static void push_child_plan(deparse_namespace *dpns, PlanState *ps, +static void set_deparse_plan(deparse_namespace *dpns, Plan *plan); +static void push_child_plan(deparse_namespace *dpns, Plan *plan, deparse_namespace *save_dpns); static void pop_child_plan(deparse_namespace *dpns, deparse_namespace *save_dpns); @@ -404,10 +418,9 @@ static void get_rule_windowspec(WindowClause *wc, List *targetList, static char *get_variable(Var *var, int levelsup, bool istoplevel, deparse_context *context); static void get_special_variable(Node *node, deparse_context *context, - void *private); + void *callback_arg); static void resolve_special_varno(Node *node, deparse_context *context, - void *private, - void (*callback) (Node *, deparse_context *, void *)); + rsv_callback callback, void *callback_arg); static Node *find_param_referent(Param *param, deparse_context *context, deparse_namespace **dpns_p, ListCell **ancestor_cell_p); static void get_parameter(Param *param, deparse_context *context); @@ -429,7 +442,7 @@ static void get_func_expr(FuncExpr *expr, deparse_context *context, static void get_agg_expr(Aggref *aggref, deparse_context *context, Aggref *original_aggref); static void get_agg_combine_expr(Node *node, deparse_context *context, - void *private); + void *callback_arg); static void get_windowfunc_expr(WindowFunc *wfunc, deparse_context *context); static void get_coercion_expr(Node *arg, deparse_context *context, Oid resulttype, int32 resulttypmod, @@ -1022,7 +1035,9 @@ pg_get_triggerdef_worker(Oid trigid, bool pretty) /* Build two-element rtable */ memset(&dpns, 0, sizeof(dpns)); dpns.rtable = list_make2(oldrte, newrte); + dpns.subplans = NIL; dpns.ctes = NIL; + dpns.appendrels = NULL; set_rtable_names(&dpns, NIL, NULL); set_simple_column_names(&dpns); @@ -1036,6 +1051,7 @@ pg_get_triggerdef_worker(Oid trigid, bool pretty) context.wrapColumn = WRAP_COLUMN_DEFAULT; context.indentLevel = PRETTYINDENT_STD; context.special_exprkind = EXPR_KIND_NONE; + context.appendparents = NULL; get_rule_expr(qual, &context, false); @@ -3238,6 +3254,7 @@ deparse_expression_pretty(Node *expr, List *dpcontext, context.wrapColumn = WRAP_COLUMN_DEFAULT; context.indentLevel = startIndent; context.special_exprkind = EXPR_KIND_NONE; + context.appendparents = NULL; get_rule_expr(expr, &context, showimplicit); @@ -3274,7 +3291,9 @@ deparse_context_for(const char *aliasname, Oid relid) /* Build one-element rtable */ dpns->rtable = list_make1(rte); + dpns->subplans = NIL; dpns->ctes = NIL; + dpns->appendrels = NULL; set_rtable_names(dpns, NIL, NULL); set_simple_column_names(dpns); @@ -3283,29 +3302,50 @@ deparse_context_for(const char *aliasname, Oid relid) } /* - * deparse_context_for_plan_rtable - Build deparse context for a plan's rtable + * deparse_context_for_plan_tree - Build deparse context for a Plan tree * * When deparsing an expression in a Plan tree, we use the plan's rangetable * to resolve names of simple Vars. The initialization of column names for * this is rather expensive if the rangetable is large, and it'll be the same * for every expression in the Plan tree; so we do it just once and re-use * the result of this function for each expression. (Note that the result - * is not usable until set_deparse_context_planstate() is applied to it.) + * is not usable until set_deparse_context_plan() is applied to it.) * - * In addition to the plan's rangetable list, pass the per-RTE alias names + * In addition to the PlannedStmt, pass the per-RTE alias names * assigned by a previous call to select_rtable_names_for_explain. */ List * -deparse_context_for_plan_rtable(List *rtable, List *rtable_names) +deparse_context_for_plan_tree(PlannedStmt *pstmt, List *rtable_names) { deparse_namespace *dpns; dpns = (deparse_namespace *) palloc0(sizeof(deparse_namespace)); /* Initialize fields that stay the same across the whole plan tree */ - dpns->rtable = rtable; + dpns->rtable = pstmt->rtable; dpns->rtable_names = rtable_names; + dpns->subplans = pstmt->subplans; dpns->ctes = NIL; + if (pstmt->appendRelations) + { + /* Set up the array, indexed by child relid */ + int ntables = list_length(dpns->rtable); + ListCell *lc; + + dpns->appendrels = (AppendRelInfo **) + palloc0((ntables + 1) * sizeof(AppendRelInfo *)); + foreach(lc, pstmt->appendRelations) + { + AppendRelInfo *appinfo = lfirst_node(AppendRelInfo, lc); + Index crelid = appinfo->child_relid; + + Assert(crelid > 0 && crelid <= ntables); + Assert(dpns->appendrels[crelid] == NULL); + dpns->appendrels[crelid] = appinfo; + } + } + else + dpns->appendrels = NULL; /* don't need it */ /* * Set up column name aliases. We will get rather bogus results for join @@ -3319,11 +3359,11 @@ deparse_context_for_plan_rtable(List *rtable, List *rtable_names) } /* - * set_deparse_context_planstate - Specify Plan node containing expression + * set_deparse_context_plan - Specify Plan node containing expression * * When deparsing an expression in a Plan tree, we might have to resolve * OUTER_VAR, INNER_VAR, or INDEX_VAR references. To do this, the caller must - * provide the parent PlanState node. Then OUTER_VAR and INNER_VAR references + * provide the parent Plan node. Then OUTER_VAR and INNER_VAR references * can be resolved by drilling down into the left and right child plans. * Similarly, INDEX_VAR references can be resolved by reference to the * indextlist given in a parent IndexOnlyScan node, or to the scan tlist in @@ -3332,23 +3372,19 @@ deparse_context_for_plan_rtable(List *rtable, List *rtable_names) * for those, we can only deparse the indexqualorig fields, which won't * contain INDEX_VAR Vars.) * - * Note: planstate really ought to be declared as "PlanState *", but we use - * "Node *" to avoid having to include execnodes.h in ruleutils.h. - * - * The ancestors list is a list of the PlanState's parent PlanStates, the - * most-closely-nested first. This is needed to resolve PARAM_EXEC Params. - * Note we assume that all the PlanStates share the same rtable. + * The ancestors list is a list of the Plan's parent Plan and SubPlan nodes, + * the most-closely-nested first. This is needed to resolve PARAM_EXEC + * Params. Note we assume that all the Plan nodes share the same rtable. * * Once this function has been called, deparse_expression() can be called on - * subsidiary expression(s) of the specified PlanState node. To deparse + * subsidiary expression(s) of the specified Plan node. To deparse * expressions of a different Plan node in the same Plan tree, re-call this * function to identify the new parent Plan node. * * The result is the same List passed in; this is a notational convenience. */ List * -set_deparse_context_planstate(List *dpcontext, - Node *planstate, List *ancestors) +set_deparse_context_plan(List *dpcontext, Plan *plan, List *ancestors) { deparse_namespace *dpns; @@ -3357,7 +3393,7 @@ set_deparse_context_planstate(List *dpcontext, dpns = (deparse_namespace *) linitial(dpcontext); /* Set our attention on the specific plan node passed in */ - set_deparse_planstate(dpns, (PlanState *) planstate); + set_deparse_plan(dpns, plan); dpns->ancestors = ancestors; return dpcontext; @@ -3377,7 +3413,9 @@ select_rtable_names_for_explain(List *rtable, Bitmapset *rels_used) memset(&dpns, 0, sizeof(dpns)); dpns.rtable = rtable; + dpns.subplans = NIL; dpns.ctes = NIL; + dpns.appendrels = NULL; set_rtable_names(&dpns, NIL, rels_used); /* We needn't bother computing column aliases yet */ @@ -3557,7 +3595,9 @@ set_deparse_for_query(deparse_namespace *dpns, Query *query, /* Initialize *dpns and fill rtable/ctes links */ memset(dpns, 0, sizeof(deparse_namespace)); dpns->rtable = query->rtable; + dpns->subplans = NIL; dpns->ctes = query->cteList; + dpns->appendrels = NULL; /* Assign a unique relation alias to each RTE */ set_rtable_names(dpns, parent_namespaces, NULL); @@ -4625,19 +4665,19 @@ get_rtable_name(int rtindex, deparse_context *context) } /* - * set_deparse_planstate: set up deparse_namespace to parse subexpressions - * of a given PlanState node + * set_deparse_plan: set up deparse_namespace to parse subexpressions + * of a given Plan node * - * This sets the planstate, outer_planstate, inner_planstate, outer_tlist, - * inner_tlist, and index_tlist fields. Caller is responsible for adjusting - * the ancestors list if necessary. Note that the rtable and ctes fields do + * This sets the plan, outer_plan, inner_plan, outer_tlist, inner_tlist, + * and index_tlist fields. Caller is responsible for adjusting the ancestors + * list if necessary. Note that the rtable, subplans, and ctes fields do * not need to change when shifting attention to different plan nodes in a * single plan tree. */ static void -set_deparse_planstate(deparse_namespace *dpns, PlanState *ps) +set_deparse_plan(deparse_namespace *dpns, Plan *plan) { - dpns->planstate = ps; + dpns->plan = plan; /* * We special-case Append and MergeAppend to pretend that the first child @@ -4647,17 +4687,17 @@ set_deparse_planstate(deparse_namespace *dpns, PlanState *ps) * first child plan is the OUTER referent; this is to support RETURNING * lists containing references to non-target relations. */ - if (IsA(ps, AppendState)) - dpns->outer_planstate = ((AppendState *) ps)->appendplans[0]; - else if (IsA(ps, MergeAppendState)) - dpns->outer_planstate = ((MergeAppendState *) ps)->mergeplans[0]; - else if (IsA(ps, ModifyTableState)) - dpns->outer_planstate = ((ModifyTableState *) ps)->mt_plans[0]; + if (IsA(plan, Append)) + dpns->outer_plan = linitial(((Append *) plan)->appendplans); + else if (IsA(plan, MergeAppend)) + dpns->outer_plan = linitial(((MergeAppend *) plan)->mergeplans); + else if (IsA(plan, ModifyTable)) + dpns->outer_plan = linitial(((ModifyTable *) plan)->plans); else - dpns->outer_planstate = outerPlanState(ps); + dpns->outer_plan = outerPlan(plan); - if (dpns->outer_planstate) - dpns->outer_tlist = dpns->outer_planstate->plan->targetlist; + if (dpns->outer_plan) + dpns->outer_tlist = dpns->outer_plan->targetlist; else dpns->outer_tlist = NIL; @@ -4670,29 +4710,30 @@ set_deparse_planstate(deparse_namespace *dpns, PlanState *ps) * to reuse OUTER, it's used for RETURNING in some modify table cases, * although not INSERT .. CONFLICT). */ - if (IsA(ps, SubqueryScanState)) - dpns->inner_planstate = ((SubqueryScanState *) ps)->subplan; - else if (IsA(ps, CteScanState)) - dpns->inner_planstate = ((CteScanState *) ps)->cteplanstate; - else if (IsA(ps, ModifyTableState)) - dpns->inner_planstate = ps; + if (IsA(plan, SubqueryScan)) + dpns->inner_plan = ((SubqueryScan *) plan)->subplan; + else if (IsA(plan, CteScan)) + dpns->inner_plan = list_nth(dpns->subplans, + ((CteScan *) plan)->ctePlanId - 1); + else if (IsA(plan, ModifyTable)) + dpns->inner_plan = plan; else - dpns->inner_planstate = innerPlanState(ps); + dpns->inner_plan = innerPlan(plan); - if (IsA(ps, ModifyTableState)) - dpns->inner_tlist = ((ModifyTableState *) ps)->mt_excludedtlist; - else if (dpns->inner_planstate) - dpns->inner_tlist = dpns->inner_planstate->plan->targetlist; + if (IsA(plan, ModifyTable)) + dpns->inner_tlist = ((ModifyTable *) plan)->exclRelTlist; + else if (dpns->inner_plan) + dpns->inner_tlist = dpns->inner_plan->targetlist; else dpns->inner_tlist = NIL; /* Set up referent for INDEX_VAR Vars, if needed */ - if (IsA(ps->plan, IndexOnlyScan)) - dpns->index_tlist = ((IndexOnlyScan *) ps->plan)->indextlist; - else if (IsA(ps->plan, ForeignScan)) - dpns->index_tlist = ((ForeignScan *) ps->plan)->fdw_scan_tlist; - else if (IsA(ps->plan, CustomScan)) - dpns->index_tlist = ((CustomScan *) ps->plan)->custom_scan_tlist; + if (IsA(plan, IndexOnlyScan)) + dpns->index_tlist = ((IndexOnlyScan *) plan)->indextlist; + else if (IsA(plan, ForeignScan)) + dpns->index_tlist = ((ForeignScan *) plan)->fdw_scan_tlist; + else if (IsA(plan, CustomScan)) + dpns->index_tlist = ((CustomScan *) plan)->custom_scan_tlist; else dpns->index_tlist = NIL; } @@ -4710,17 +4751,17 @@ set_deparse_planstate(deparse_namespace *dpns, PlanState *ps) * previous state for pop_child_plan. */ static void -push_child_plan(deparse_namespace *dpns, PlanState *ps, +push_child_plan(deparse_namespace *dpns, Plan *plan, deparse_namespace *save_dpns) { /* Save state for restoration later */ *save_dpns = *dpns; /* Link current plan node into ancestors list */ - dpns->ancestors = lcons(dpns->planstate, dpns->ancestors); + dpns->ancestors = lcons(dpns->plan, dpns->ancestors); /* Set attention on selected child */ - set_deparse_planstate(dpns, ps); + set_deparse_plan(dpns, plan); } /* @@ -4760,7 +4801,7 @@ static void push_ancestor_plan(deparse_namespace *dpns, ListCell *ancestor_cell, deparse_namespace *save_dpns) { - PlanState *ps = (PlanState *) lfirst(ancestor_cell); + Plan *plan = (Plan *) lfirst(ancestor_cell); /* Save state for restoration later */ *save_dpns = *dpns; @@ -4771,7 +4812,7 @@ push_ancestor_plan(deparse_namespace *dpns, ListCell *ancestor_cell, list_cell_number(dpns->ancestors, ancestor_cell) + 1); /* Set attention on selected ancestor */ - set_deparse_planstate(dpns, ps); + set_deparse_plan(dpns, plan); } /* @@ -4931,6 +4972,7 @@ make_ruledef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc, context.wrapColumn = WRAP_COLUMN_DEFAULT; context.indentLevel = PRETTYINDENT_STD; context.special_exprkind = EXPR_KIND_NONE; + context.appendparents = NULL; set_deparse_for_query(&dpns, query, NIL); @@ -5093,6 +5135,7 @@ get_query_def(Query *query, StringInfo buf, List *parentnamespace, context.wrapColumn = wrapColumn; context.indentLevel = startIndent; context.special_exprkind = EXPR_KIND_NONE; + context.appendparents = NULL; set_deparse_for_query(&dpns, query, parentnamespace); @@ -6694,15 +6737,62 @@ get_variable(Var *var, int levelsup, bool istoplevel, deparse_context *context) */ if (var->varno >= 1 && var->varno <= list_length(dpns->rtable)) { - rte = rt_fetch(var->varno, dpns->rtable); - refname = (char *) list_nth(dpns->rtable_names, var->varno - 1); - colinfo = deparse_columns_fetch(var->varno, dpns); - attnum = var->varattno; + Index varno = var->varno; + AttrNumber varattno = var->varattno; + + /* + * We might have been asked to map child Vars to some parent relation. + */ + if (context->appendparents && dpns->appendrels) + { + Index pvarno = varno; + AttrNumber pvarattno = varattno; + AppendRelInfo *appinfo = dpns->appendrels[pvarno]; + bool found = false; + + /* Only map up to inheritance parents, not UNION ALL appendrels */ + while (appinfo && + rt_fetch(appinfo->parent_relid, + dpns->rtable)->rtekind == RTE_RELATION) + { + found = false; + if (pvarattno > 0) /* system columns stay as-is */ + { + if (pvarattno > appinfo->num_child_cols) + break; /* safety check */ + pvarattno = appinfo->parent_colnos[pvarattno - 1]; + if (pvarattno == 0) + break; /* Var is local to child */ + } + + pvarno = appinfo->parent_relid; + found = true; + + /* If the parent is itself a child, continue up. */ + Assert(pvarno > 0 && pvarno <= list_length(dpns->rtable)); + appinfo = dpns->appendrels[pvarno]; + } + + /* + * If we found an ancestral rel, and that rel is included in + * appendparents, print that column not the original one. + */ + if (found && bms_is_member(pvarno, context->appendparents)) + { + varno = pvarno; + varattno = pvarattno; + } + } + + rte = rt_fetch(varno, dpns->rtable); + refname = (char *) list_nth(dpns->rtable_names, varno - 1); + colinfo = deparse_columns_fetch(varno, dpns); + attnum = varattno; } else { - resolve_special_varno((Node *) var, context, NULL, - get_special_variable); + resolve_special_varno((Node *) var, context, + get_special_variable, NULL); return NULL; } @@ -6715,22 +6805,22 @@ get_variable(Var *var, int levelsup, bool istoplevel, deparse_context *context) * no alias. So in that case, drill down to the subplan and print the * contents of the referenced tlist item. This works because in a plan * tree, such Vars can only occur in a SubqueryScan or CteScan node, and - * we'll have set dpns->inner_planstate to reference the child plan node. + * we'll have set dpns->inner_plan to reference the child plan node. */ if ((rte->rtekind == RTE_SUBQUERY || rte->rtekind == RTE_CTE) && attnum > list_length(rte->eref->colnames) && - dpns->inner_planstate) + dpns->inner_plan) { TargetEntry *tle; deparse_namespace save_dpns; - tle = get_tle_by_resno(dpns->inner_tlist, var->varattno); + tle = get_tle_by_resno(dpns->inner_tlist, attnum); if (!tle) elog(ERROR, "invalid attnum %d for relation \"%s\"", - var->varattno, rte->eref->aliasname); + attnum, rte->eref->aliasname); Assert(netlevelsup == 0); - push_child_plan(dpns, dpns->inner_planstate, &save_dpns); + push_child_plan(dpns, dpns->inner_plan, &save_dpns); /* * Force parentheses because our caller probably assumed a Var is a @@ -6829,13 +6919,13 @@ get_variable(Var *var, int levelsup, bool istoplevel, deparse_context *context) * get_rule_expr. */ static void -get_special_variable(Node *node, deparse_context *context, void *private) +get_special_variable(Node *node, deparse_context *context, void *callback_arg) { StringInfo buf = context->buf; /* - * Force parentheses because our caller probably assumed a Var is a simple - * expression. + * For a non-Var referent, force parentheses because our caller probably + * assumed a Var is a simple expression. */ if (!IsA(node, Var)) appendStringInfoChar(buf, '('); @@ -6850,16 +6940,19 @@ get_special_variable(Node *node, deparse_context *context, void *private) * invoke the callback provided. */ static void -resolve_special_varno(Node *node, deparse_context *context, void *private, - void (*callback) (Node *, deparse_context *, void *)) +resolve_special_varno(Node *node, deparse_context *context, + rsv_callback callback, void *callback_arg) { Var *var; deparse_namespace *dpns; + /* This function is recursive, so let's be paranoid. */ + check_stack_depth(); + /* If it's not a Var, invoke the callback. */ if (!IsA(node, Var)) { - callback(node, context, private); + (*callback) (node, context, callback_arg); return; } @@ -6869,20 +6962,37 @@ resolve_special_varno(Node *node, deparse_context *context, void *private, var->varlevelsup); /* - * It's a special RTE, so recurse. + * If varno is special, recurse. */ if (var->varno == OUTER_VAR && dpns->outer_tlist) { TargetEntry *tle; deparse_namespace save_dpns; + Bitmapset *save_appendparents; tle = get_tle_by_resno(dpns->outer_tlist, var->varattno); if (!tle) elog(ERROR, "bogus varattno for OUTER_VAR var: %d", var->varattno); - push_child_plan(dpns, dpns->outer_planstate, &save_dpns); - resolve_special_varno((Node *) tle->expr, context, private, callback); + /* + * If we're descending to the first child of an Append or MergeAppend, + * update appendparents. This will affect deparsing of all Vars + * appearing within the eventually-resolved subexpression. + */ + save_appendparents = context->appendparents; + + if (IsA(dpns->plan, Append)) + context->appendparents = bms_union(context->appendparents, + ((Append *) dpns->plan)->apprelids); + else if (IsA(dpns->plan, MergeAppend)) + context->appendparents = bms_union(context->appendparents, + ((MergeAppend *) dpns->plan)->apprelids); + + push_child_plan(dpns, dpns->outer_plan, &save_dpns); + resolve_special_varno((Node *) tle->expr, context, + callback, callback_arg); pop_child_plan(dpns, &save_dpns); + context->appendparents = save_appendparents; return; } else if (var->varno == INNER_VAR && dpns->inner_tlist) @@ -6894,8 +7004,9 @@ resolve_special_varno(Node *node, deparse_context *context, void *private, if (!tle) elog(ERROR, "bogus varattno for INNER_VAR var: %d", var->varattno); - push_child_plan(dpns, dpns->inner_planstate, &save_dpns); - resolve_special_varno((Node *) tle->expr, context, private, callback); + push_child_plan(dpns, dpns->inner_plan, &save_dpns); + resolve_special_varno((Node *) tle->expr, context, + callback, callback_arg); pop_child_plan(dpns, &save_dpns); return; } @@ -6907,14 +7018,15 @@ resolve_special_varno(Node *node, deparse_context *context, void *private, if (!tle) elog(ERROR, "bogus varattno for INDEX_VAR var: %d", var->varattno); - resolve_special_varno((Node *) tle->expr, context, private, callback); + resolve_special_varno((Node *) tle->expr, context, + callback, callback_arg); return; } else if (var->varno < 1 || var->varno > list_length(dpns->rtable)) elog(ERROR, "bogus varno: %d", var->varno); /* Not special. Just invoke the callback. */ - callback(node, context, private); + (*callback) (node, context, callback_arg); } /* @@ -7005,6 +7117,10 @@ get_name_for_var_field(Var *var, int fieldno, * Try to find the relevant RTE in this rtable. In a plan tree, it's * likely that varno is OUTER_VAR or INNER_VAR, in which case we must dig * down into the subplans, or INDEX_VAR, which is resolved similarly. + * + * Note: unlike get_variable and resolve_special_varno, we need not worry + * about inheritance mapping: a child Var should have the same datatype as + * its parent, and here we're really only interested in the Var's type. */ if (var->varno >= 1 && var->varno <= list_length(dpns->rtable)) { @@ -7022,7 +7138,7 @@ get_name_for_var_field(Var *var, int fieldno, elog(ERROR, "bogus varattno for OUTER_VAR var: %d", var->varattno); Assert(netlevelsup == 0); - push_child_plan(dpns, dpns->outer_planstate, &save_dpns); + push_child_plan(dpns, dpns->outer_plan, &save_dpns); result = get_name_for_var_field((Var *) tle->expr, fieldno, levelsup, context); @@ -7041,7 +7157,7 @@ get_name_for_var_field(Var *var, int fieldno, elog(ERROR, "bogus varattno for INNER_VAR var: %d", var->varattno); Assert(netlevelsup == 0); - push_child_plan(dpns, dpns->inner_planstate, &save_dpns); + push_child_plan(dpns, dpns->inner_plan, &save_dpns); result = get_name_for_var_field((Var *) tle->expr, fieldno, levelsup, context); @@ -7151,7 +7267,7 @@ get_name_for_var_field(Var *var, int fieldno, deparse_namespace save_dpns; const char *result; - if (!dpns->inner_planstate) + if (!dpns->inner_plan) elog(ERROR, "failed to find plan for subquery %s", rte->eref->aliasname); tle = get_tle_by_resno(dpns->inner_tlist, attnum); @@ -7159,7 +7275,7 @@ get_name_for_var_field(Var *var, int fieldno, elog(ERROR, "bogus varattno for subquery var: %d", attnum); Assert(netlevelsup == 0); - push_child_plan(dpns, dpns->inner_planstate, &save_dpns); + push_child_plan(dpns, dpns->inner_plan, &save_dpns); result = get_name_for_var_field((Var *) tle->expr, fieldno, levelsup, context); @@ -7269,7 +7385,7 @@ get_name_for_var_field(Var *var, int fieldno, deparse_namespace save_dpns; const char *result; - if (!dpns->inner_planstate) + if (!dpns->inner_plan) elog(ERROR, "failed to find plan for CTE %s", rte->eref->aliasname); tle = get_tle_by_resno(dpns->inner_tlist, attnum); @@ -7277,7 +7393,7 @@ get_name_for_var_field(Var *var, int fieldno, elog(ERROR, "bogus varattno for subquery var: %d", attnum); Assert(netlevelsup == 0); - push_child_plan(dpns, dpns->inner_planstate, &save_dpns); + push_child_plan(dpns, dpns->inner_plan, &save_dpns); result = get_name_for_var_field((Var *) tle->expr, fieldno, levelsup, context); @@ -7318,22 +7434,22 @@ find_param_referent(Param *param, deparse_context *context, /* * If it's a PARAM_EXEC parameter, look for a matching NestLoopParam or * SubPlan argument. This will necessarily be in some ancestor of the - * current expression's PlanState. + * current expression's Plan node. */ if (param->paramkind == PARAM_EXEC) { deparse_namespace *dpns; - PlanState *child_ps; + Plan *child_plan; bool in_same_plan_level; ListCell *lc; dpns = (deparse_namespace *) linitial(context->namespaces); - child_ps = dpns->planstate; + child_plan = dpns->plan; in_same_plan_level = true; foreach(lc, dpns->ancestors) { - PlanState *ps = (PlanState *) lfirst(lc); + Node *ancestor = (Node *) lfirst(lc); ListCell *lc2; /* @@ -7341,11 +7457,11 @@ find_param_referent(Param *param, deparse_context *context, * we've crawled up out of a subplan, this couldn't possibly be * the right match. */ - if (IsA(ps, NestLoopState) && - child_ps == innerPlanState(ps) && + if (IsA(ancestor, NestLoop) && + child_plan == innerPlan(ancestor) && in_same_plan_level) { - NestLoop *nl = (NestLoop *) ps->plan; + NestLoop *nl = (NestLoop *) ancestor; foreach(lc2, nl->nestParams) { @@ -7362,19 +7478,14 @@ find_param_referent(Param *param, deparse_context *context, } /* - * Check to see if we're crawling up from a subplan. + * If ancestor is a SubPlan, check the arguments it provides. */ - foreach(lc2, ps->subPlan) + if (IsA(ancestor, SubPlan)) { - SubPlanState *sstate = (SubPlanState *) lfirst(lc2); - SubPlan *subplan = sstate->subplan; + SubPlan *subplan = (SubPlan *) ancestor; ListCell *lc3; ListCell *lc4; - if (child_ps != sstate->planstate) - continue; - - /* Matched subplan, so check its arguments */ forboth(lc3, subplan->parParam, lc4, subplan->args) { int paramid = lfirst_int(lc3); @@ -7382,41 +7493,61 @@ find_param_referent(Param *param, deparse_context *context, if (paramid == param->paramid) { - /* Found a match, so return it */ - *dpns_p = dpns; - *ancestor_cell_p = lc; - return arg; + /* + * Found a match, so return it. But, since Vars in + * the arg are to be evaluated in the surrounding + * context, we have to point to the next ancestor item + * that is *not* a SubPlan. + */ + ListCell *rest; + + for_each_cell(rest, dpns->ancestors, + lnext(dpns->ancestors, lc)) + { + Node *ancestor2 = (Node *) lfirst(rest); + + if (!IsA(ancestor2, SubPlan)) + { + *dpns_p = dpns; + *ancestor_cell_p = rest; + return arg; + } + } + elog(ERROR, "SubPlan cannot be outermost ancestor"); } } - /* Keep looking, but we are emerging from a subplan. */ + /* We have emerged from a subplan. */ in_same_plan_level = false; - break; + + /* SubPlan isn't a kind of Plan, so skip the rest */ + continue; } /* - * Likewise check to see if we're emerging from an initplan. - * Initplans never have any parParams, so no need to search that - * list, but we need to know if we should reset + * Check to see if we're emerging from an initplan of the current + * ancestor plan. Initplans never have any parParams, so no need + * to search that list, but we need to know if we should reset * in_same_plan_level. */ - foreach(lc2, ps->initPlan) + foreach(lc2, ((Plan *) ancestor)->initPlan) { - SubPlanState *sstate = (SubPlanState *) lfirst(lc2); + SubPlan *subplan = castNode(SubPlan, lfirst(lc2)); - if (child_ps != sstate->planstate) + if (child_plan != (Plan *) list_nth(dpns->subplans, + subplan->plan_id - 1)) continue; /* No parameters to be had here. */ - Assert(sstate->subplan->parParam == NIL); + Assert(subplan->parParam == NIL); - /* Keep looking, but we are emerging from an initplan. */ + /* We have emerged from an initplan. */ in_same_plan_level = false; break; } /* No luck, crawl up to next ancestor */ - child_ps = ps; + child_plan = (Plan *) ancestor; } } @@ -9269,11 +9400,12 @@ get_agg_expr(Aggref *aggref, deparse_context *context, */ if (DO_AGGSPLIT_COMBINE(aggref->aggsplit)) { - TargetEntry *tle = linitial_node(TargetEntry, aggref->args); + TargetEntry *tle; Assert(list_length(aggref->args) == 1); - resolve_special_varno((Node *) tle->expr, context, original_aggref, - get_agg_combine_expr); + tle = linitial_node(TargetEntry, aggref->args); + resolve_special_varno((Node *) tle->expr, context, + get_agg_combine_expr, original_aggref); return; } @@ -9358,10 +9490,10 @@ get_agg_expr(Aggref *aggref, deparse_context *context, * Aggref and then calls this. */ static void -get_agg_combine_expr(Node *node, deparse_context *context, void *private) +get_agg_combine_expr(Node *node, deparse_context *context, void *callback_arg) { Aggref *aggref; - Aggref *original_aggref = private; + Aggref *original_aggref = callback_arg; if (!IsA(node, Aggref)) elog(ERROR, "combining Aggref does not point to an Aggref"); diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 692438d6df..ea93b769e1 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1171,7 +1171,6 @@ typedef struct ModifyTableState List **mt_arowmarks; /* per-subplan ExecAuxRowMark lists */ EPQState mt_epqstate; /* for evaluating EvalPlanQual rechecks */ bool fireBSTriggers; /* do we need to fire stmt triggers? */ - List *mt_excludedtlist; /* the excluded pseudo relation's tlist */ /* * Slot for storing tuples in the root partitioned table's rowtype during diff --git a/src/include/nodes/pathnodes.h b/src/include/nodes/pathnodes.h index 6dab810d68..31b631cfe0 100644 --- a/src/include/nodes/pathnodes.h +++ b/src/include/nodes/pathnodes.h @@ -122,6 +122,8 @@ typedef struct PlannerGlobal List *rootResultRelations; /* "flat" list of integer RT indexes */ + List *appendRelations; /* "flat" list of AppendRelInfos */ + List *relationOids; /* OIDs of relations the plan depends on */ List *invalItems; /* other dependencies, as PlanInvalItems */ diff --git a/src/include/nodes/plannodes.h b/src/include/nodes/plannodes.h index 8e6594e355..477b4da192 100644 --- a/src/include/nodes/plannodes.h +++ b/src/include/nodes/plannodes.h @@ -74,6 +74,8 @@ typedef struct PlannedStmt */ List *rootResultRelations; + List *appendRelations; /* list of AppendRelInfo nodes */ + List *subplans; /* Plan trees for SubPlan expressions; note * that some could be NULL */ @@ -249,6 +251,7 @@ struct PartitionPruneInfo; /* forward reference to struct below */ typedef struct Append { Plan plan; + Bitmapset *apprelids; /* RTIs of appendrel(s) formed by this node */ List *appendplans; /* @@ -269,6 +272,7 @@ typedef struct Append typedef struct MergeAppend { Plan plan; + Bitmapset *apprelids; /* RTIs of appendrel(s) formed by this node */ List *mergeplans; /* these fields are just like the sort-key info in struct Sort: */ int numCols; /* number of sort-key columns */ diff --git a/src/include/utils/ruleutils.h b/src/include/utils/ruleutils.h index d34cad2f4b..ac408905fa 100644 --- a/src/include/utils/ruleutils.h +++ b/src/include/utils/ruleutils.h @@ -17,6 +17,9 @@ #include "nodes/parsenodes.h" #include "nodes/pg_list.h" +struct Plan; /* avoid including plannodes.h here */ +struct PlannedStmt; + extern char *pg_get_indexdef_string(Oid indexrelid); extern char *pg_get_indexdef_columns(Oid indexrelid, bool pretty); @@ -28,9 +31,10 @@ extern char *pg_get_constraintdef_command(Oid constraintId); extern char *deparse_expression(Node *expr, List *dpcontext, bool forceprefix, bool showimplicit); extern List *deparse_context_for(const char *aliasname, Oid relid); -extern List *deparse_context_for_plan_rtable(List *rtable, List *rtable_names); -extern List *set_deparse_context_planstate(List *dpcontext, - Node *planstate, List *ancestors); +extern List *deparse_context_for_plan_tree(struct PlannedStmt *pstmt, + List *rtable_names); +extern List *set_deparse_context_plan(List *dpcontext, + struct Plan *plan, List *ancestors); extern List *select_rtable_names_for_explain(List *rtable, Bitmapset *rels_used); extern char *generate_collation_name(Oid collid); diff --git a/src/test/regress/expected/aggregates.out b/src/test/regress/expected/aggregates.out index 0b097f9652..d091ae4c6e 100644 --- a/src/test/regress/expected/aggregates.out +++ b/src/test/regress/expected/aggregates.out @@ -1005,24 +1005,24 @@ explain (costs off) -> Limit -> Merge Append Sort Key: minmaxtest.f1 - -> Index Only Scan using minmaxtesti on minmaxtest + -> Index Only Scan using minmaxtesti on minmaxtest minmaxtest_1 Index Cond: (f1 IS NOT NULL) - -> Index Only Scan using minmaxtest1i on minmaxtest1 minmaxtest_1 + -> Index Only Scan using minmaxtest1i on minmaxtest1 minmaxtest_2 Index Cond: (f1 IS NOT NULL) - -> Index Only Scan Backward using minmaxtest2i on minmaxtest2 minmaxtest_2 + -> Index Only Scan Backward using minmaxtest2i on minmaxtest2 minmaxtest_3 Index Cond: (f1 IS NOT NULL) - -> Index Only Scan using minmaxtest3i on minmaxtest3 minmaxtest_3 + -> Index Only Scan using minmaxtest3i on minmaxtest3 minmaxtest_4 InitPlan 2 (returns $1) -> Limit -> Merge Append - Sort Key: minmaxtest_4.f1 DESC - -> Index Only Scan Backward using minmaxtesti on minmaxtest minmaxtest_4 + Sort Key: minmaxtest_5.f1 DESC + -> Index Only Scan Backward using minmaxtesti on minmaxtest minmaxtest_6 Index Cond: (f1 IS NOT NULL) - -> Index Only Scan Backward using minmaxtest1i on minmaxtest1 minmaxtest_5 + -> Index Only Scan Backward using minmaxtest1i on minmaxtest1 minmaxtest_7 Index Cond: (f1 IS NOT NULL) - -> Index Only Scan using minmaxtest2i on minmaxtest2 minmaxtest_6 + -> Index Only Scan using minmaxtest2i on minmaxtest2 minmaxtest_8 Index Cond: (f1 IS NOT NULL) - -> Index Only Scan Backward using minmaxtest3i on minmaxtest3 minmaxtest_7 + -> Index Only Scan Backward using minmaxtest3i on minmaxtest3 minmaxtest_9 (23 rows) select min(f1), max(f1) from minmaxtest; @@ -1041,24 +1041,24 @@ explain (costs off) -> Limit -> Merge Append Sort Key: minmaxtest.f1 - -> Index Only Scan using minmaxtesti on minmaxtest + -> Index Only Scan using minmaxtesti on minmaxtest minmaxtest_1 Index Cond: (f1 IS NOT NULL) - -> Index Only Scan using minmaxtest1i on minmaxtest1 minmaxtest_1 + -> Index Only Scan using minmaxtest1i on minmaxtest1 minmaxtest_2 Index Cond: (f1 IS NOT NULL) - -> Index Only Scan Backward using minmaxtest2i on minmaxtest2 minmaxtest_2 + -> Index Only Scan Backward using minmaxtest2i on minmaxtest2 minmaxtest_3 Index Cond: (f1 IS NOT NULL) - -> Index Only Scan using minmaxtest3i on minmaxtest3 minmaxtest_3 + -> Index Only Scan using minmaxtest3i on minmaxtest3 minmaxtest_4 InitPlan 2 (returns $1) -> Limit -> Merge Append - Sort Key: minmaxtest_4.f1 DESC - -> Index Only Scan Backward using minmaxtesti on minmaxtest minmaxtest_4 + Sort Key: minmaxtest_5.f1 DESC + -> Index Only Scan Backward using minmaxtesti on minmaxtest minmaxtest_6 Index Cond: (f1 IS NOT NULL) - -> Index Only Scan Backward using minmaxtest1i on minmaxtest1 minmaxtest_5 + -> Index Only Scan Backward using minmaxtest1i on minmaxtest1 minmaxtest_7 Index Cond: (f1 IS NOT NULL) - -> Index Only Scan using minmaxtest2i on minmaxtest2 minmaxtest_6 + -> Index Only Scan using minmaxtest2i on minmaxtest2 minmaxtest_8 Index Cond: (f1 IS NOT NULL) - -> Index Only Scan Backward using minmaxtest3i on minmaxtest3 minmaxtest_7 + -> Index Only Scan Backward using minmaxtest3i on minmaxtest3 minmaxtest_9 -> Sort Sort Key: ($0), ($1) -> Result @@ -1155,8 +1155,8 @@ explain (costs off) select * from t1 group by a,b,c,d; HashAggregate Group Key: t1.a, t1.b, t1.c, t1.d -> Append - -> Seq Scan on t1 - -> Seq Scan on t1c t1_1 + -> Seq Scan on t1 t1_1 + -> Seq Scan on t1c t1_2 (5 rows) -- Okay to remove columns if we're only querying the parent. @@ -1179,13 +1179,13 @@ create temp table p_t1_1 partition of p_t1 for values in(1); create temp table p_t1_2 partition of p_t1 for values in(2); -- Ensure we can remove non-PK columns for partitioned tables. explain (costs off) select * from p_t1 group by a,b,c,d; - QUERY PLAN ---------------------------------------- + QUERY PLAN +-------------------------------- HashAggregate Group Key: p_t1.a, p_t1.b -> Append - -> Seq Scan on p_t1_1 p_t1 - -> Seq Scan on p_t1_2 p_t1_1 + -> Seq Scan on p_t1_1 + -> Seq Scan on p_t1_2 (5 rows) drop table t1 cascade; diff --git a/src/test/regress/expected/alter_table.out b/src/test/regress/expected/alter_table.out index e71d2f24dd..b492c606ab 100644 --- a/src/test/regress/expected/alter_table.out +++ b/src/test/regress/expected/alter_table.out @@ -540,11 +540,11 @@ explain (costs off) select * from nv_parent where d between '2011-08-01' and '20 QUERY PLAN --------------------------------------------------------------------------- Append - -> Seq Scan on nv_parent + -> Seq Scan on nv_parent nv_parent_1 Filter: ((d >= '08-01-2011'::date) AND (d <= '08-31-2011'::date)) - -> Seq Scan on nv_child_2010 nv_parent_1 + -> Seq Scan on nv_child_2010 nv_parent_2 Filter: ((d >= '08-01-2011'::date) AND (d <= '08-31-2011'::date)) - -> Seq Scan on nv_child_2011 nv_parent_2 + -> Seq Scan on nv_child_2011 nv_parent_3 Filter: ((d >= '08-01-2011'::date) AND (d <= '08-31-2011'::date)) (7 rows) @@ -553,11 +553,11 @@ explain (costs off) select * from nv_parent where d between '2011-08-01'::date a QUERY PLAN --------------------------------------------------------------------------- Append - -> Seq Scan on nv_parent + -> Seq Scan on nv_parent nv_parent_1 Filter: ((d >= '08-01-2011'::date) AND (d <= '08-31-2011'::date)) - -> Seq Scan on nv_child_2010 nv_parent_1 + -> Seq Scan on nv_child_2010 nv_parent_2 Filter: ((d >= '08-01-2011'::date) AND (d <= '08-31-2011'::date)) - -> Seq Scan on nv_child_2011 nv_parent_2 + -> Seq Scan on nv_child_2011 nv_parent_3 Filter: ((d >= '08-01-2011'::date) AND (d <= '08-31-2011'::date)) (7 rows) @@ -565,13 +565,13 @@ explain (costs off) select * from nv_parent where d between '2009-08-01'::date a QUERY PLAN --------------------------------------------------------------------------- Append - -> Seq Scan on nv_parent + -> Seq Scan on nv_parent nv_parent_1 Filter: ((d >= '08-01-2009'::date) AND (d <= '08-31-2009'::date)) - -> Seq Scan on nv_child_2010 nv_parent_1 + -> Seq Scan on nv_child_2010 nv_parent_2 Filter: ((d >= '08-01-2009'::date) AND (d <= '08-31-2009'::date)) - -> Seq Scan on nv_child_2011 nv_parent_2 + -> Seq Scan on nv_child_2011 nv_parent_3 Filter: ((d >= '08-01-2009'::date) AND (d <= '08-31-2009'::date)) - -> Seq Scan on nv_child_2009 nv_parent_3 + -> Seq Scan on nv_child_2009 nv_parent_4 Filter: ((d >= '08-01-2009'::date) AND (d <= '08-31-2009'::date)) (9 rows) @@ -581,11 +581,11 @@ explain (costs off) select * from nv_parent where d between '2009-08-01'::date a QUERY PLAN --------------------------------------------------------------------------- Append - -> Seq Scan on nv_parent + -> Seq Scan on nv_parent nv_parent_1 Filter: ((d >= '08-01-2009'::date) AND (d <= '08-31-2009'::date)) - -> Seq Scan on nv_child_2010 nv_parent_1 + -> Seq Scan on nv_child_2010 nv_parent_2 Filter: ((d >= '08-01-2009'::date) AND (d <= '08-31-2009'::date)) - -> Seq Scan on nv_child_2009 nv_parent_2 + -> Seq Scan on nv_child_2009 nv_parent_3 Filter: ((d >= '08-01-2009'::date) AND (d <= '08-31-2009'::date)) (7 rows) diff --git a/src/test/regress/expected/inherit.out b/src/test/regress/expected/inherit.out index 680d47f5ac..d8f56d2f5c 100644 --- a/src/test/regress/expected/inherit.out +++ b/src/test/regress/expected/inherit.out @@ -1338,11 +1338,11 @@ select * from patest0 join (select f1 from int4_tbl limit 1) ss on id = f1; -> Limit -> Seq Scan on int4_tbl -> Append - -> Index Scan using patest0i on patest0 + -> Index Scan using patest0i on patest0 patest0_1 Index Cond: (id = int4_tbl.f1) - -> Index Scan using patest1i on patest1 patest0_1 + -> Index Scan using patest1i on patest1 patest0_2 Index Cond: (id = int4_tbl.f1) - -> Index Scan using patest2i on patest2 patest0_2 + -> Index Scan using patest2i on patest2 patest0_3 Index Cond: (id = int4_tbl.f1) (10 rows) @@ -1363,11 +1363,11 @@ select * from patest0 join (select f1 from int4_tbl limit 1) ss on id = f1; -> Limit -> Seq Scan on int4_tbl -> Append - -> Index Scan using patest0i on patest0 + -> Index Scan using patest0i on patest0 patest0_1 Index Cond: (id = int4_tbl.f1) - -> Index Scan using patest1i on patest1 patest0_1 + -> Index Scan using patest1i on patest1 patest0_2 Index Cond: (id = int4_tbl.f1) - -> Seq Scan on patest2 patest0_2 + -> Seq Scan on patest2 patest0_3 Filter: (int4_tbl.f1 = id) (10 rows) @@ -1413,14 +1413,14 @@ explain (verbose, costs off) select * from matest0 order by 1-id; -> Result Output: matest0.id, matest0.name, (1 - matest0.id) -> Append - -> Seq Scan on public.matest0 - Output: matest0.id, matest0.name - -> Seq Scan on public.matest1 matest0_1 + -> Seq Scan on public.matest0 matest0_1 Output: matest0_1.id, matest0_1.name - -> Seq Scan on public.matest2 matest0_2 + -> Seq Scan on public.matest1 matest0_2 Output: matest0_2.id, matest0_2.name - -> Seq Scan on public.matest3 matest0_3 + -> Seq Scan on public.matest2 matest0_3 Output: matest0_3.id, matest0_3.name + -> Seq Scan on public.matest3 matest0_4 + Output: matest0_4.id, matest0_4.name (14 rows) select * from matest0 order by 1-id; @@ -1440,14 +1440,14 @@ explain (verbose, costs off) select min(1-id) from matest0; Aggregate Output: min((1 - matest0.id)) -> Append - -> Seq Scan on public.matest0 - Output: matest0.id - -> Seq Scan on public.matest1 matest0_1 + -> Seq Scan on public.matest0 matest0_1 Output: matest0_1.id - -> Seq Scan on public.matest2 matest0_2 + -> Seq Scan on public.matest1 matest0_2 Output: matest0_2.id - -> Seq Scan on public.matest3 matest0_3 + -> Seq Scan on public.matest2 matest0_3 Output: matest0_3.id + -> Seq Scan on public.matest3 matest0_4 + Output: matest0_4.id (11 rows) select min(1-id) from matest0; @@ -1464,17 +1464,17 @@ explain (verbose, costs off) select * from matest0 order by 1-id; ------------------------------------------------------------------------ Merge Append Sort Key: ((1 - matest0.id)) - -> Index Scan using matest0i on public.matest0 - Output: matest0.id, matest0.name, (1 - matest0.id) - -> Index Scan using matest1i on public.matest1 matest0_1 + -> Index Scan using matest0i on public.matest0 matest0_1 Output: matest0_1.id, matest0_1.name, (1 - matest0_1.id) + -> Index Scan using matest1i on public.matest1 matest0_2 + Output: matest0_2.id, matest0_2.name, (1 - matest0_2.id) -> Sort - Output: matest0_2.id, matest0_2.name, ((1 - matest0_2.id)) - Sort Key: ((1 - matest0_2.id)) - -> Seq Scan on public.matest2 matest0_2 - Output: matest0_2.id, matest0_2.name, (1 - matest0_2.id) - -> Index Scan using matest3i on public.matest3 matest0_3 - Output: matest0_3.id, matest0_3.name, (1 - matest0_3.id) + Output: matest0_3.id, matest0_3.name, ((1 - matest0_3.id)) + Sort Key: ((1 - matest0_3.id)) + -> Seq Scan on public.matest2 matest0_3 + Output: matest0_3.id, matest0_3.name, (1 - matest0_3.id) + -> Index Scan using matest3i on public.matest3 matest0_4 + Output: matest0_4.id, matest0_4.name, (1 - matest0_4.id) (13 rows) select * from matest0 order by 1-id; @@ -1500,22 +1500,22 @@ explain (verbose, costs off) select min(1-id) from matest0; Output: ((1 - matest0.id)) -> Merge Append Sort Key: ((1 - matest0.id)) - -> Index Scan using matest0i on public.matest0 - Output: matest0.id, (1 - matest0.id) - Index Cond: ((1 - matest0.id) IS NOT NULL) - -> Index Scan using matest1i on public.matest1 matest0_1 + -> Index Scan using matest0i on public.matest0 matest0_1 Output: matest0_1.id, (1 - matest0_1.id) Index Cond: ((1 - matest0_1.id) IS NOT NULL) + -> Index Scan using matest1i on public.matest1 matest0_2 + Output: matest0_2.id, (1 - matest0_2.id) + Index Cond: ((1 - matest0_2.id) IS NOT NULL) -> Sort - Output: matest0_2.id, ((1 - matest0_2.id)) - Sort Key: ((1 - matest0_2.id)) - -> Bitmap Heap Scan on public.matest2 matest0_2 - Output: matest0_2.id, (1 - matest0_2.id) - Filter: ((1 - matest0_2.id) IS NOT NULL) + Output: matest0_3.id, ((1 - matest0_3.id)) + Sort Key: ((1 - matest0_3.id)) + -> Bitmap Heap Scan on public.matest2 matest0_3 + Output: matest0_3.id, (1 - matest0_3.id) + Filter: ((1 - matest0_3.id) IS NOT NULL) -> Bitmap Index Scan on matest2_pkey - -> Index Scan using matest3i on public.matest3 matest0_3 - Output: matest0_3.id, (1 - matest0_3.id) - Index Cond: ((1 - matest0_3.id) IS NOT NULL) + -> Index Scan using matest3i on public.matest3 matest0_4 + Output: matest0_4.id, (1 - matest0_4.id) + Index Cond: ((1 - matest0_4.id) IS NOT NULL) (25 rows) select min(1-id) from matest0; @@ -1551,14 +1551,14 @@ order by t1.b limit 10; Merge Cond: (t1.b = t2.b) -> Merge Append Sort Key: t1.b - -> Index Scan using matest0i on matest0 t1 - -> Index Scan using matest1i on matest1 t1_1 + -> Index Scan using matest0i on matest0 t1_1 + -> Index Scan using matest1i on matest1 t1_2 -> Materialize -> Merge Append Sort Key: t2.b - -> Index Scan using matest0i on matest0 t2 + -> Index Scan using matest0i on matest0 t2_1 Filter: (c = d) - -> Index Scan using matest1i on matest1 t2_1 + -> Index Scan using matest1i on matest1 t2_2 Filter: (c = d) (14 rows) @@ -1783,9 +1783,9 @@ explain (costs off) select * from list_parted; QUERY PLAN ---------------------------------------------- Append - -> Seq Scan on part_ab_cd list_parted - -> Seq Scan on part_ef_gh list_parted_1 - -> Seq Scan on part_null_xy list_parted_2 + -> Seq Scan on part_ab_cd list_parted_1 + -> Seq Scan on part_ef_gh list_parted_2 + -> Seq Scan on part_null_xy list_parted_3 (4 rows) explain (costs off) select * from list_parted where a is null; @@ -1799,11 +1799,11 @@ explain (costs off) select * from list_parted where a is not null; QUERY PLAN ---------------------------------------------- Append - -> Seq Scan on part_ab_cd list_parted + -> Seq Scan on part_ab_cd list_parted_1 Filter: (a IS NOT NULL) - -> Seq Scan on part_ef_gh list_parted_1 + -> Seq Scan on part_ef_gh list_parted_2 Filter: (a IS NOT NULL) - -> Seq Scan on part_null_xy list_parted_2 + -> Seq Scan on part_null_xy list_parted_3 Filter: (a IS NOT NULL) (7 rows) @@ -1811,9 +1811,9 @@ explain (costs off) select * from list_parted where a in ('ab', 'cd', 'ef'); QUERY PLAN ---------------------------------------------------------- Append - -> Seq Scan on part_ab_cd list_parted + -> Seq Scan on part_ab_cd list_parted_1 Filter: ((a)::text = ANY ('{ab,cd,ef}'::text[])) - -> Seq Scan on part_ef_gh list_parted_1 + -> Seq Scan on part_ef_gh list_parted_2 Filter: ((a)::text = ANY ('{ab,cd,ef}'::text[])) (5 rows) @@ -1852,24 +1852,24 @@ explain (costs off) select * from range_list_parted; QUERY PLAN -------------------------------------------------------- Append - -> Seq Scan on part_1_10_ab range_list_parted - -> Seq Scan on part_1_10_cd range_list_parted_1 - -> Seq Scan on part_10_20_ab range_list_parted_2 - -> Seq Scan on part_10_20_cd range_list_parted_3 - -> Seq Scan on part_21_30_ab range_list_parted_4 - -> Seq Scan on part_21_30_cd range_list_parted_5 - -> Seq Scan on part_40_inf_ab range_list_parted_6 - -> Seq Scan on part_40_inf_cd range_list_parted_7 - -> Seq Scan on part_40_inf_null range_list_parted_8 + -> Seq Scan on part_1_10_ab range_list_parted_1 + -> Seq Scan on part_1_10_cd range_list_parted_2 + -> Seq Scan on part_10_20_ab range_list_parted_3 + -> Seq Scan on part_10_20_cd range_list_parted_4 + -> Seq Scan on part_21_30_ab range_list_parted_5 + -> Seq Scan on part_21_30_cd range_list_parted_6 + -> Seq Scan on part_40_inf_ab range_list_parted_7 + -> Seq Scan on part_40_inf_cd range_list_parted_8 + -> Seq Scan on part_40_inf_null range_list_parted_9 (10 rows) explain (costs off) select * from range_list_parted where a = 5; QUERY PLAN ---------------------------------------------------- Append - -> Seq Scan on part_1_10_ab range_list_parted + -> Seq Scan on part_1_10_ab range_list_parted_1 Filter: (a = 5) - -> Seq Scan on part_1_10_cd range_list_parted_1 + -> Seq Scan on part_1_10_cd range_list_parted_2 Filter: (a = 5) (5 rows) @@ -1877,13 +1877,13 @@ explain (costs off) select * from range_list_parted where b = 'ab'; QUERY PLAN ------------------------------------------------------ Append - -> Seq Scan on part_1_10_ab range_list_parted + -> Seq Scan on part_1_10_ab range_list_parted_1 Filter: (b = 'ab'::bpchar) - -> Seq Scan on part_10_20_ab range_list_parted_1 + -> Seq Scan on part_10_20_ab range_list_parted_2 Filter: (b = 'ab'::bpchar) - -> Seq Scan on part_21_30_ab range_list_parted_2 + -> Seq Scan on part_21_30_ab range_list_parted_3 Filter: (b = 'ab'::bpchar) - -> Seq Scan on part_40_inf_ab range_list_parted_3 + -> Seq Scan on part_40_inf_ab range_list_parted_4 Filter: (b = 'ab'::bpchar) (9 rows) @@ -1891,11 +1891,11 @@ explain (costs off) select * from range_list_parted where a between 3 and 23 and QUERY PLAN ----------------------------------------------------------------- Append - -> Seq Scan on part_1_10_ab range_list_parted + -> Seq Scan on part_1_10_ab range_list_parted_1 Filter: ((a >= 3) AND (a <= 23) AND (b = 'ab'::bpchar)) - -> Seq Scan on part_10_20_ab range_list_parted_1 + -> Seq Scan on part_10_20_ab range_list_parted_2 Filter: ((a >= 3) AND (a <= 23) AND (b = 'ab'::bpchar)) - -> Seq Scan on part_21_30_ab range_list_parted_2 + -> Seq Scan on part_21_30_ab range_list_parted_3 Filter: ((a >= 3) AND (a <= 23) AND (b = 'ab'::bpchar)) (7 rows) @@ -1919,23 +1919,23 @@ explain (costs off) select * from range_list_parted where a is not null and a < QUERY PLAN -------------------------------------------------------- Append - -> Seq Scan on part_1_10_ab range_list_parted + -> Seq Scan on part_1_10_ab range_list_parted_1 Filter: ((a IS NOT NULL) AND (a < 67)) - -> Seq Scan on part_1_10_cd range_list_parted_1 + -> Seq Scan on part_1_10_cd range_list_parted_2 Filter: ((a IS NOT NULL) AND (a < 67)) - -> Seq Scan on part_10_20_ab range_list_parted_2 + -> Seq Scan on part_10_20_ab range_list_parted_3 Filter: ((a IS NOT NULL) AND (a < 67)) - -> Seq Scan on part_10_20_cd range_list_parted_3 + -> Seq Scan on part_10_20_cd range_list_parted_4 Filter: ((a IS NOT NULL) AND (a < 67)) - -> Seq Scan on part_21_30_ab range_list_parted_4 + -> Seq Scan on part_21_30_ab range_list_parted_5 Filter: ((a IS NOT NULL) AND (a < 67)) - -> Seq Scan on part_21_30_cd range_list_parted_5 + -> Seq Scan on part_21_30_cd range_list_parted_6 Filter: ((a IS NOT NULL) AND (a < 67)) - -> Seq Scan on part_40_inf_ab range_list_parted_6 + -> Seq Scan on part_40_inf_ab range_list_parted_7 Filter: ((a IS NOT NULL) AND (a < 67)) - -> Seq Scan on part_40_inf_cd range_list_parted_7 + -> Seq Scan on part_40_inf_cd range_list_parted_8 Filter: ((a IS NOT NULL) AND (a < 67)) - -> Seq Scan on part_40_inf_null range_list_parted_8 + -> Seq Scan on part_40_inf_null range_list_parted_9 Filter: ((a IS NOT NULL) AND (a < 67)) (19 rows) @@ -1943,11 +1943,11 @@ explain (costs off) select * from range_list_parted where a >= 30; QUERY PLAN -------------------------------------------------------- Append - -> Seq Scan on part_40_inf_ab range_list_parted + -> Seq Scan on part_40_inf_ab range_list_parted_1 Filter: (a >= 30) - -> Seq Scan on part_40_inf_cd range_list_parted_1 + -> Seq Scan on part_40_inf_cd range_list_parted_2 Filter: (a >= 30) - -> Seq Scan on part_40_inf_null range_list_parted_2 + -> Seq Scan on part_40_inf_null range_list_parted_3 Filter: (a >= 30) (7 rows) @@ -1967,9 +1967,9 @@ explain (costs off) select * from mcrparted where a = 0; -- scans mcrparted0, mc QUERY PLAN --------------------------------------------- Append - -> Seq Scan on mcrparted0 mcrparted + -> Seq Scan on mcrparted0 mcrparted_1 Filter: (a = 0) - -> Seq Scan on mcrparted_def mcrparted_1 + -> Seq Scan on mcrparted_def mcrparted_2 Filter: (a = 0) (5 rows) @@ -1977,9 +1977,9 @@ explain (costs off) select * from mcrparted where a = 10 and abs(b) < 5; -- scan QUERY PLAN --------------------------------------------- Append - -> Seq Scan on mcrparted1 mcrparted + -> Seq Scan on mcrparted1 mcrparted_1 Filter: ((a = 10) AND (abs(b) < 5)) - -> Seq Scan on mcrparted_def mcrparted_1 + -> Seq Scan on mcrparted_def mcrparted_2 Filter: ((a = 10) AND (abs(b) < 5)) (5 rows) @@ -1987,11 +1987,11 @@ explain (costs off) select * from mcrparted where a = 10 and abs(b) = 5; -- scan QUERY PLAN --------------------------------------------- Append - -> Seq Scan on mcrparted1 mcrparted + -> Seq Scan on mcrparted1 mcrparted_1 Filter: ((a = 10) AND (abs(b) = 5)) - -> Seq Scan on mcrparted2 mcrparted_1 + -> Seq Scan on mcrparted2 mcrparted_2 Filter: ((a = 10) AND (abs(b) = 5)) - -> Seq Scan on mcrparted_def mcrparted_2 + -> Seq Scan on mcrparted_def mcrparted_3 Filter: ((a = 10) AND (abs(b) = 5)) (7 rows) @@ -1999,19 +1999,19 @@ explain (costs off) select * from mcrparted where abs(b) = 5; -- scans all parti QUERY PLAN --------------------------------------------- Append - -> Seq Scan on mcrparted0 mcrparted + -> Seq Scan on mcrparted0 mcrparted_1 Filter: (abs(b) = 5) - -> Seq Scan on mcrparted1 mcrparted_1 + -> Seq Scan on mcrparted1 mcrparted_2 Filter: (abs(b) = 5) - -> Seq Scan on mcrparted2 mcrparted_2 + -> Seq Scan on mcrparted2 mcrparted_3 Filter: (abs(b) = 5) - -> Seq Scan on mcrparted3 mcrparted_3 + -> Seq Scan on mcrparted3 mcrparted_4 Filter: (abs(b) = 5) - -> Seq Scan on mcrparted4 mcrparted_4 + -> Seq Scan on mcrparted4 mcrparted_5 Filter: (abs(b) = 5) - -> Seq Scan on mcrparted5 mcrparted_5 + -> Seq Scan on mcrparted5 mcrparted_6 Filter: (abs(b) = 5) - -> Seq Scan on mcrparted_def mcrparted_6 + -> Seq Scan on mcrparted_def mcrparted_7 Filter: (abs(b) = 5) (15 rows) @@ -2019,19 +2019,19 @@ explain (costs off) select * from mcrparted where a > -1; -- scans all partition QUERY PLAN --------------------------------------------- Append - -> Seq Scan on mcrparted0 mcrparted + -> Seq Scan on mcrparted0 mcrparted_1 Filter: (a > '-1'::integer) - -> Seq Scan on mcrparted1 mcrparted_1 + -> Seq Scan on mcrparted1 mcrparted_2 Filter: (a > '-1'::integer) - -> Seq Scan on mcrparted2 mcrparted_2 + -> Seq Scan on mcrparted2 mcrparted_3 Filter: (a > '-1'::integer) - -> Seq Scan on mcrparted3 mcrparted_3 + -> Seq Scan on mcrparted3 mcrparted_4 Filter: (a > '-1'::integer) - -> Seq Scan on mcrparted4 mcrparted_4 + -> Seq Scan on mcrparted4 mcrparted_5 Filter: (a > '-1'::integer) - -> Seq Scan on mcrparted5 mcrparted_5 + -> Seq Scan on mcrparted5 mcrparted_6 Filter: (a > '-1'::integer) - -> Seq Scan on mcrparted_def mcrparted_6 + -> Seq Scan on mcrparted_def mcrparted_7 Filter: (a > '-1'::integer) (15 rows) @@ -2046,13 +2046,13 @@ explain (costs off) select * from mcrparted where a = 20 and c > 20; -- scans mc QUERY PLAN --------------------------------------------- Append - -> Seq Scan on mcrparted3 mcrparted + -> Seq Scan on mcrparted3 mcrparted_1 Filter: ((c > 20) AND (a = 20)) - -> Seq Scan on mcrparted4 mcrparted_1 + -> Seq Scan on mcrparted4 mcrparted_2 Filter: ((c > 20) AND (a = 20)) - -> Seq Scan on mcrparted5 mcrparted_2 + -> Seq Scan on mcrparted5 mcrparted_3 Filter: ((c > 20) AND (a = 20)) - -> Seq Scan on mcrparted_def mcrparted_3 + -> Seq Scan on mcrparted_def mcrparted_4 Filter: ((c > 20) AND (a = 20)) (9 rows) @@ -2092,13 +2092,13 @@ explain (costs off) select * from mcrparted order by a, abs(b), c; ------------------------------------------------------------------------------- Merge Append Sort Key: mcrparted.a, (abs(mcrparted.b)), mcrparted.c - -> Index Scan using mcrparted0_a_abs_c_idx on mcrparted0 mcrparted - -> Index Scan using mcrparted1_a_abs_c_idx on mcrparted1 mcrparted_1 - -> Index Scan using mcrparted2_a_abs_c_idx on mcrparted2 mcrparted_2 - -> Index Scan using mcrparted3_a_abs_c_idx on mcrparted3 mcrparted_3 - -> Index Scan using mcrparted4_a_abs_c_idx on mcrparted4 mcrparted_4 - -> Index Scan using mcrparted5_a_abs_c_idx on mcrparted5 mcrparted_5 - -> Index Scan using mcrparted_def_a_abs_c_idx on mcrparted_def mcrparted_6 + -> Index Scan using mcrparted0_a_abs_c_idx on mcrparted0 mcrparted_1 + -> Index Scan using mcrparted1_a_abs_c_idx on mcrparted1 mcrparted_2 + -> Index Scan using mcrparted2_a_abs_c_idx on mcrparted2 mcrparted_3 + -> Index Scan using mcrparted3_a_abs_c_idx on mcrparted3 mcrparted_4 + -> Index Scan using mcrparted4_a_abs_c_idx on mcrparted4 mcrparted_5 + -> Index Scan using mcrparted5_a_abs_c_idx on mcrparted5 mcrparted_6 + -> Index Scan using mcrparted_def_a_abs_c_idx on mcrparted_def mcrparted_7 (9 rows) drop table mcrparted_def; @@ -2108,12 +2108,12 @@ explain (costs off) select * from mcrparted order by a, abs(b), c; QUERY PLAN ------------------------------------------------------------------------- Append - -> Index Scan using mcrparted0_a_abs_c_idx on mcrparted0 mcrparted - -> Index Scan using mcrparted1_a_abs_c_idx on mcrparted1 mcrparted_1 - -> Index Scan using mcrparted2_a_abs_c_idx on mcrparted2 mcrparted_2 - -> Index Scan using mcrparted3_a_abs_c_idx on mcrparted3 mcrparted_3 - -> Index Scan using mcrparted4_a_abs_c_idx on mcrparted4 mcrparted_4 - -> Index Scan using mcrparted5_a_abs_c_idx on mcrparted5 mcrparted_5 + -> Index Scan using mcrparted0_a_abs_c_idx on mcrparted0 mcrparted_1 + -> Index Scan using mcrparted1_a_abs_c_idx on mcrparted1 mcrparted_2 + -> Index Scan using mcrparted2_a_abs_c_idx on mcrparted2 mcrparted_3 + -> Index Scan using mcrparted3_a_abs_c_idx on mcrparted3 mcrparted_4 + -> Index Scan using mcrparted4_a_abs_c_idx on mcrparted4 mcrparted_5 + -> Index Scan using mcrparted5_a_abs_c_idx on mcrparted5 mcrparted_6 (7 rows) -- Append is used with subpaths in reverse order with backwards index scans @@ -2121,12 +2121,12 @@ explain (costs off) select * from mcrparted order by a desc, abs(b) desc, c desc QUERY PLAN ---------------------------------------------------------------------------------- Append - -> Index Scan Backward using mcrparted5_a_abs_c_idx on mcrparted5 mcrparted_5 - -> Index Scan Backward using mcrparted4_a_abs_c_idx on mcrparted4 mcrparted_4 - -> Index Scan Backward using mcrparted3_a_abs_c_idx on mcrparted3 mcrparted_3 - -> Index Scan Backward using mcrparted2_a_abs_c_idx on mcrparted2 mcrparted_2 - -> Index Scan Backward using mcrparted1_a_abs_c_idx on mcrparted1 mcrparted_1 - -> Index Scan Backward using mcrparted0_a_abs_c_idx on mcrparted0 mcrparted + -> Index Scan Backward using mcrparted5_a_abs_c_idx on mcrparted5 mcrparted_6 + -> Index Scan Backward using mcrparted4_a_abs_c_idx on mcrparted4 mcrparted_5 + -> Index Scan Backward using mcrparted3_a_abs_c_idx on mcrparted3 mcrparted_4 + -> Index Scan Backward using mcrparted2_a_abs_c_idx on mcrparted2 mcrparted_3 + -> Index Scan Backward using mcrparted1_a_abs_c_idx on mcrparted1 mcrparted_2 + -> Index Scan Backward using mcrparted0_a_abs_c_idx on mcrparted0 mcrparted_1 (7 rows) -- check that Append plan is used containing a MergeAppend for sub-partitions @@ -2139,15 +2139,15 @@ explain (costs off) select * from mcrparted order by a, abs(b), c; QUERY PLAN --------------------------------------------------------------------------------------- Append - -> Index Scan using mcrparted0_a_abs_c_idx on mcrparted0 mcrparted - -> Index Scan using mcrparted1_a_abs_c_idx on mcrparted1 mcrparted_1 - -> Index Scan using mcrparted2_a_abs_c_idx on mcrparted2 mcrparted_2 - -> Index Scan using mcrparted3_a_abs_c_idx on mcrparted3 mcrparted_3 - -> Index Scan using mcrparted4_a_abs_c_idx on mcrparted4 mcrparted_4 + -> Index Scan using mcrparted0_a_abs_c_idx on mcrparted0 mcrparted_1 + -> Index Scan using mcrparted1_a_abs_c_idx on mcrparted1 mcrparted_2 + -> Index Scan using mcrparted2_a_abs_c_idx on mcrparted2 mcrparted_3 + -> Index Scan using mcrparted3_a_abs_c_idx on mcrparted3 mcrparted_4 + -> Index Scan using mcrparted4_a_abs_c_idx on mcrparted4 mcrparted_5 -> Merge Append - Sort Key: mcrparted_5.a, (abs(mcrparted_5.b)), mcrparted_5.c - -> Index Scan using mcrparted5a_a_abs_c_idx on mcrparted5a mcrparted_5 - -> Index Scan using mcrparted5_def_a_abs_c_idx on mcrparted5_def mcrparted_6 + Sort Key: mcrparted_7.a, (abs(mcrparted_7.b)), mcrparted_7.c + -> Index Scan using mcrparted5a_a_abs_c_idx on mcrparted5a mcrparted_7 + -> Index Scan using mcrparted5_def_a_abs_c_idx on mcrparted5_def mcrparted_8 (10 rows) drop table mcrparted5_def; @@ -2158,12 +2158,12 @@ explain (costs off) select a, abs(b) from mcrparted order by a, abs(b), c; QUERY PLAN --------------------------------------------------------------------------- Append - -> Index Scan using mcrparted0_a_abs_c_idx on mcrparted0 mcrparted - -> Index Scan using mcrparted1_a_abs_c_idx on mcrparted1 mcrparted_1 - -> Index Scan using mcrparted2_a_abs_c_idx on mcrparted2 mcrparted_2 - -> Index Scan using mcrparted3_a_abs_c_idx on mcrparted3 mcrparted_3 - -> Index Scan using mcrparted4_a_abs_c_idx on mcrparted4 mcrparted_4 - -> Index Scan using mcrparted5a_a_abs_c_idx on mcrparted5a mcrparted_5 + -> Index Scan using mcrparted0_a_abs_c_idx on mcrparted0 mcrparted_1 + -> Index Scan using mcrparted1_a_abs_c_idx on mcrparted1 mcrparted_2 + -> Index Scan using mcrparted2_a_abs_c_idx on mcrparted2 mcrparted_3 + -> Index Scan using mcrparted3_a_abs_c_idx on mcrparted3 mcrparted_4 + -> Index Scan using mcrparted4_a_abs_c_idx on mcrparted4 mcrparted_5 + -> Index Scan using mcrparted5a_a_abs_c_idx on mcrparted5a mcrparted_6 (7 rows) -- check that Append is used when the sub-partitioned tables are pruned @@ -2172,13 +2172,13 @@ explain (costs off) select * from mcrparted where a < 20 order by a, abs(b), c; QUERY PLAN ------------------------------------------------------------------------- Append - -> Index Scan using mcrparted0_a_abs_c_idx on mcrparted0 mcrparted + -> Index Scan using mcrparted0_a_abs_c_idx on mcrparted0 mcrparted_1 Index Cond: (a < 20) - -> Index Scan using mcrparted1_a_abs_c_idx on mcrparted1 mcrparted_1 + -> Index Scan using mcrparted1_a_abs_c_idx on mcrparted1 mcrparted_2 Index Cond: (a < 20) - -> Index Scan using mcrparted2_a_abs_c_idx on mcrparted2 mcrparted_2 + -> Index Scan using mcrparted2_a_abs_c_idx on mcrparted2 mcrparted_3 Index Cond: (a < 20) - -> Index Scan using mcrparted3_a_abs_c_idx on mcrparted3 mcrparted_3 + -> Index Scan using mcrparted3_a_abs_c_idx on mcrparted3 mcrparted_4 Index Cond: (a < 20) (9 rows) @@ -2191,8 +2191,8 @@ explain (costs off) select * from mclparted order by a; QUERY PLAN ------------------------------------------------------------------------ Append - -> Index Only Scan using mclparted1_a_idx on mclparted1 mclparted - -> Index Only Scan using mclparted2_a_idx on mclparted2 mclparted_1 + -> Index Only Scan using mclparted1_a_idx on mclparted1 mclparted_1 + -> Index Only Scan using mclparted2_a_idx on mclparted2 mclparted_2 (3 rows) -- Ensure a MergeAppend is used when a partition exists with interleaved @@ -2204,10 +2204,10 @@ explain (costs off) select * from mclparted order by a; ---------------------------------------------------------------------------- Merge Append Sort Key: mclparted.a - -> Index Only Scan using mclparted1_a_idx on mclparted1 mclparted - -> Index Only Scan using mclparted2_a_idx on mclparted2 mclparted_1 - -> Index Only Scan using mclparted3_5_a_idx on mclparted3_5 mclparted_2 - -> Index Only Scan using mclparted4_a_idx on mclparted4 mclparted_3 + -> Index Only Scan using mclparted1_a_idx on mclparted1 mclparted_1 + -> Index Only Scan using mclparted2_a_idx on mclparted2 mclparted_2 + -> Index Only Scan using mclparted3_5_a_idx on mclparted3_5 mclparted_3 + -> Index Only Scan using mclparted4_a_idx on mclparted4 mclparted_4 (6 rows) drop table mclparted; @@ -2224,14 +2224,14 @@ explain (costs off) select * from mcrparted where a < 20 order by a, abs(b), c l Limit -> Append -> Sort - Sort Key: mcrparted.a, (abs(mcrparted.b)), mcrparted.c - -> Seq Scan on mcrparted0 mcrparted + Sort Key: mcrparted_1.a, (abs(mcrparted_1.b)), mcrparted_1.c + -> Seq Scan on mcrparted0 mcrparted_1 Filter: (a < 20) - -> Index Scan using mcrparted1_a_abs_c_idx on mcrparted1 mcrparted_1 + -> Index Scan using mcrparted1_a_abs_c_idx on mcrparted1 mcrparted_2 Index Cond: (a < 20) - -> Index Scan using mcrparted2_a_abs_c_idx on mcrparted2 mcrparted_2 + -> Index Scan using mcrparted2_a_abs_c_idx on mcrparted2 mcrparted_3 Index Cond: (a < 20) - -> Index Scan using mcrparted3_a_abs_c_idx on mcrparted3 mcrparted_3 + -> Index Scan using mcrparted3_a_abs_c_idx on mcrparted3 mcrparted_4 Index Cond: (a < 20) (12 rows) @@ -2242,9 +2242,9 @@ explain (costs off) select * from mcrparted where a = 10 order by a, abs(b), c; QUERY PLAN ------------------------------------------------------------------------- Append - -> Index Scan using mcrparted1_a_abs_c_idx on mcrparted1 mcrparted + -> Index Scan using mcrparted1_a_abs_c_idx on mcrparted1 mcrparted_1 Index Cond: (a = 10) - -> Index Scan using mcrparted2_a_abs_c_idx on mcrparted2 mcrparted_1 + -> Index Scan using mcrparted2_a_abs_c_idx on mcrparted2 mcrparted_2 Index Cond: (a = 10) (5 rows) @@ -2256,11 +2256,11 @@ create table bool_lp_true partition of bool_lp for values in(true); create table bool_lp_false partition of bool_lp for values in(false); create index on bool_lp (b); explain (costs off) select * from bool_lp order by b; - QUERY PLAN --------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------- Append - -> Index Only Scan using bool_lp_false_b_idx on bool_lp_false bool_lp - -> Index Only Scan using bool_lp_true_b_idx on bool_lp_true bool_lp_1 + -> Index Only Scan using bool_lp_false_b_idx on bool_lp_false bool_lp_1 + -> Index Only Scan using bool_lp_true_b_idx on bool_lp_true bool_lp_2 (3 rows) drop table bool_lp; @@ -2275,9 +2275,9 @@ explain (costs off) select * from bool_rp where b = true order by b,a; QUERY PLAN ---------------------------------------------------------------------------------- Append - -> Index Only Scan using bool_rp_true_1k_b_a_idx on bool_rp_true_1k bool_rp + -> Index Only Scan using bool_rp_true_1k_b_a_idx on bool_rp_true_1k bool_rp_1 Index Cond: (b = true) - -> Index Only Scan using bool_rp_true_2k_b_a_idx on bool_rp_true_2k bool_rp_1 + -> Index Only Scan using bool_rp_true_2k_b_a_idx on bool_rp_true_2k bool_rp_2 Index Cond: (b = true) (5 rows) @@ -2285,9 +2285,9 @@ explain (costs off) select * from bool_rp where b = false order by b,a; QUERY PLAN ------------------------------------------------------------------------------------ Append - -> Index Only Scan using bool_rp_false_1k_b_a_idx on bool_rp_false_1k bool_rp + -> Index Only Scan using bool_rp_false_1k_b_a_idx on bool_rp_false_1k bool_rp_1 Index Cond: (b = false) - -> Index Only Scan using bool_rp_false_2k_b_a_idx on bool_rp_false_2k bool_rp_1 + -> Index Only Scan using bool_rp_false_2k_b_a_idx on bool_rp_false_2k bool_rp_2 Index Cond: (b = false) (5 rows) @@ -2295,9 +2295,9 @@ explain (costs off) select * from bool_rp where b = true order by a; QUERY PLAN ---------------------------------------------------------------------------------- Append - -> Index Only Scan using bool_rp_true_1k_b_a_idx on bool_rp_true_1k bool_rp + -> Index Only Scan using bool_rp_true_1k_b_a_idx on bool_rp_true_1k bool_rp_1 Index Cond: (b = true) - -> Index Only Scan using bool_rp_true_2k_b_a_idx on bool_rp_true_2k bool_rp_1 + -> Index Only Scan using bool_rp_true_2k_b_a_idx on bool_rp_true_2k bool_rp_2 Index Cond: (b = true) (5 rows) @@ -2305,9 +2305,9 @@ explain (costs off) select * from bool_rp where b = false order by a; QUERY PLAN ------------------------------------------------------------------------------------ Append - -> Index Only Scan using bool_rp_false_1k_b_a_idx on bool_rp_false_1k bool_rp + -> Index Only Scan using bool_rp_false_1k_b_a_idx on bool_rp_false_1k bool_rp_1 Index Cond: (b = false) - -> Index Only Scan using bool_rp_false_2k_b_a_idx on bool_rp_false_2k bool_rp_1 + -> Index Only Scan using bool_rp_false_2k_b_a_idx on bool_rp_false_2k bool_rp_2 Index Cond: (b = false) (5 rows) @@ -2322,16 +2322,16 @@ explain (costs off) select * from range_parted order by a,b,c; QUERY PLAN ------------------------------------------------------------------------------------- Append - -> Index Only Scan using range_parted1_a_b_c_idx on range_parted1 range_parted - -> Index Only Scan using range_parted2_a_b_c_idx on range_parted2 range_parted_1 + -> Index Only Scan using range_parted1_a_b_c_idx on range_parted1 range_parted_1 + -> Index Only Scan using range_parted2_a_b_c_idx on range_parted2 range_parted_2 (3 rows) explain (costs off) select * from range_parted order by a desc,b desc,c desc; QUERY PLAN ---------------------------------------------------------------------------------------------- Append - -> Index Only Scan Backward using range_parted2_a_b_c_idx on range_parted2 range_parted_1 - -> Index Only Scan Backward using range_parted1_a_b_c_idx on range_parted1 range_parted + -> Index Only Scan Backward using range_parted2_a_b_c_idx on range_parted2 range_parted_2 + -> Index Only Scan Backward using range_parted1_a_b_c_idx on range_parted1 range_parted_1 (3 rows) drop table range_parted; diff --git a/src/test/regress/expected/join.out b/src/test/regress/expected/join.out index b58d560163..1a08e6321d 100644 --- a/src/test/regress/expected/join.out +++ b/src/test/regress/expected/join.out @@ -5779,8 +5779,8 @@ select t1.b, ss.phv from join_ut1 t1 left join lateral (select t2.a as t2a, t3.a t3a, least(t1.a, t2.a, t3.a) phv from join_pt1 t2 join join_ut1 t3 on t2.a = t3.b) ss on t1.a = ss.t2a order by t1.a; - QUERY PLAN ------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------- Sort Output: t1.b, (LEAST(t1.a, t2.a, t3.a)), t1.a Sort Key: t1.a @@ -5796,12 +5796,12 @@ select t1.b, ss.phv from join_ut1 t1 left join lateral -> Hash Output: t2.a -> Append - -> Seq Scan on public.join_pt1p1p1 t2 - Output: t2.a - Filter: (t1.a = t2.a) - -> Seq Scan on public.join_pt1p2 t2_1 + -> Seq Scan on public.join_pt1p1p1 t2_1 Output: t2_1.a Filter: (t1.a = t2_1.a) + -> Seq Scan on public.join_pt1p2 t2_2 + Output: t2_2.a + Filter: (t1.a = t2_2.a) (21 rows) select t1.b, ss.phv from join_ut1 t1 left join lateral diff --git a/src/test/regress/expected/partition_aggregate.out b/src/test/regress/expected/partition_aggregate.out index b3fec2a21c..fbc8d3ac6c 100644 --- a/src/test/regress/expected/partition_aggregate.out +++ b/src/test/regress/expected/partition_aggregate.out @@ -343,9 +343,9 @@ SELECT c, sum(a) FROM pagg_tab GROUP BY rollup(c) ORDER BY 1, 2; Hash Key: pagg_tab.c Group Key: () -> Append - -> Seq Scan on pagg_tab_p1 pagg_tab - -> Seq Scan on pagg_tab_p2 pagg_tab_1 - -> Seq Scan on pagg_tab_p3 pagg_tab_2 + -> Seq Scan on pagg_tab_p1 pagg_tab_1 + -> Seq Scan on pagg_tab_p2 pagg_tab_2 + -> Seq Scan on pagg_tab_p3 pagg_tab_3 (9 rows) -- ORDERED SET within the aggregate. @@ -390,9 +390,9 @@ SELECT a, sum(b order by a) FROM pagg_tab GROUP BY a ORDER BY 1, 2; -> Sort Sort Key: pagg_tab.a -> Append - -> Seq Scan on pagg_tab_p1 pagg_tab - -> Seq Scan on pagg_tab_p2 pagg_tab_1 - -> Seq Scan on pagg_tab_p3 pagg_tab_2 + -> Seq Scan on pagg_tab_p1 pagg_tab_1 + -> Seq Scan on pagg_tab_p2 pagg_tab_2 + -> Seq Scan on pagg_tab_p3 pagg_tab_3 (10 rows) -- JOIN query @@ -461,14 +461,14 @@ SELECT t1.x, sum(t1.y), count(t1) FROM pagg_tab1 t1, pagg_tab2 t2 WHERE t1.x = t -> Hash Join Hash Cond: (t1.x = t2.y) -> Append - -> Seq Scan on pagg_tab1_p1 t1 - -> Seq Scan on pagg_tab1_p2 t1_1 - -> Seq Scan on pagg_tab1_p3 t1_2 + -> Seq Scan on pagg_tab1_p1 t1_1 + -> Seq Scan on pagg_tab1_p2 t1_2 + -> Seq Scan on pagg_tab1_p3 t1_3 -> Hash -> Append - -> Seq Scan on pagg_tab2_p1 t2 - -> Seq Scan on pagg_tab2_p2 t2_1 - -> Seq Scan on pagg_tab2_p3 t2_2 + -> Seq Scan on pagg_tab2_p1 t2_1 + -> Seq Scan on pagg_tab2_p2 t2_2 + -> Seq Scan on pagg_tab2_p3 t2_3 (15 rows) SELECT t1.x, sum(t1.y), count(t1) FROM pagg_tab1 t1, pagg_tab2 t2 WHERE t1.x = t2.y GROUP BY t1.x ORDER BY 1, 2, 3; @@ -732,15 +732,15 @@ SELECT a.x, b.y, count(*) FROM (SELECT * FROM pagg_tab1 WHERE x < 20) a LEFT JOI Hash Cond: (pagg_tab1.x = pagg_tab2.y) Filter: ((pagg_tab1.x > 5) OR (pagg_tab2.y < 20)) -> Append - -> Seq Scan on pagg_tab1_p1 pagg_tab1 + -> Seq Scan on pagg_tab1_p1 pagg_tab1_1 Filter: (x < 20) - -> Seq Scan on pagg_tab1_p2 pagg_tab1_1 + -> Seq Scan on pagg_tab1_p2 pagg_tab1_2 Filter: (x < 20) -> Hash -> Append - -> Seq Scan on pagg_tab2_p2 pagg_tab2 + -> Seq Scan on pagg_tab2_p2 pagg_tab2_1 Filter: (y > 10) - -> Seq Scan on pagg_tab2_p3 pagg_tab2_1 + -> Seq Scan on pagg_tab2_p3 pagg_tab2_2 Filter: (y > 10) (18 rows) @@ -772,15 +772,15 @@ SELECT a.x, b.y, count(*) FROM (SELECT * FROM pagg_tab1 WHERE x < 20) a FULL JOI Hash Cond: (pagg_tab1.x = pagg_tab2.y) Filter: ((pagg_tab1.x > 5) OR (pagg_tab2.y < 20)) -> Append - -> Seq Scan on pagg_tab1_p1 pagg_tab1 + -> Seq Scan on pagg_tab1_p1 pagg_tab1_1 Filter: (x < 20) - -> Seq Scan on pagg_tab1_p2 pagg_tab1_1 + -> Seq Scan on pagg_tab1_p2 pagg_tab1_2 Filter: (x < 20) -> Hash -> Append - -> Seq Scan on pagg_tab2_p2 pagg_tab2 + -> Seq Scan on pagg_tab2_p2 pagg_tab2_1 Filter: (y > 10) - -> Seq Scan on pagg_tab2_p3 pagg_tab2_1 + -> Seq Scan on pagg_tab2_p3 pagg_tab2_2 Filter: (y > 10) (18 rows) @@ -946,26 +946,26 @@ SELECT a, sum(b), array_agg(distinct c), count(*) FROM pagg_tab_ml GROUP BY a HA QUERY PLAN -------------------------------------------------------------------------------------------- Sort - Sort Key: pagg_tab_ml_1.a, (sum(pagg_tab_ml_1.b)), (array_agg(DISTINCT pagg_tab_ml_1.c)) + Sort Key: pagg_tab_ml_2.a, (sum(pagg_tab_ml_2.b)), (array_agg(DISTINCT pagg_tab_ml_2.c)) -> Gather Workers Planned: 2 -> Parallel Append -> GroupAggregate - Group Key: pagg_tab_ml_1.a - Filter: (avg(pagg_tab_ml_1.b) < '3'::numeric) + Group Key: pagg_tab_ml_2.a + Filter: (avg(pagg_tab_ml_2.b) < '3'::numeric) -> Sort - Sort Key: pagg_tab_ml_1.a + Sort Key: pagg_tab_ml_2.a -> Append - -> Seq Scan on pagg_tab_ml_p2_s1 pagg_tab_ml_1 - -> Seq Scan on pagg_tab_ml_p2_s2 pagg_tab_ml_2 + -> Seq Scan on pagg_tab_ml_p2_s1 pagg_tab_ml_2 + -> Seq Scan on pagg_tab_ml_p2_s2 pagg_tab_ml_3 -> GroupAggregate - Group Key: pagg_tab_ml_3.a - Filter: (avg(pagg_tab_ml_3.b) < '3'::numeric) + Group Key: pagg_tab_ml_5.a + Filter: (avg(pagg_tab_ml_5.b) < '3'::numeric) -> Sort - Sort Key: pagg_tab_ml_3.a + Sort Key: pagg_tab_ml_5.a -> Append - -> Seq Scan on pagg_tab_ml_p3_s1 pagg_tab_ml_3 - -> Seq Scan on pagg_tab_ml_p3_s2 pagg_tab_ml_4 + -> Seq Scan on pagg_tab_ml_p3_s1 pagg_tab_ml_5 + -> Seq Scan on pagg_tab_ml_p3_s2 pagg_tab_ml_6 -> GroupAggregate Group Key: pagg_tab_ml.a Filter: (avg(pagg_tab_ml.b) < '3'::numeric) @@ -997,21 +997,21 @@ SELECT a, sum(b), array_agg(distinct c), count(*) FROM pagg_tab_ml GROUP BY a HA Workers Planned: 2 -> Parallel Append -> GroupAggregate - Group Key: pagg_tab_ml_1.a - Filter: (avg(pagg_tab_ml_1.b) < '3'::numeric) + Group Key: pagg_tab_ml_2.a + Filter: (avg(pagg_tab_ml_2.b) < '3'::numeric) -> Sort - Sort Key: pagg_tab_ml_1.a + Sort Key: pagg_tab_ml_2.a -> Append - -> Seq Scan on pagg_tab_ml_p2_s1 pagg_tab_ml_1 - -> Seq Scan on pagg_tab_ml_p2_s2 pagg_tab_ml_2 + -> Seq Scan on pagg_tab_ml_p2_s1 pagg_tab_ml_2 + -> Seq Scan on pagg_tab_ml_p2_s2 pagg_tab_ml_3 -> GroupAggregate - Group Key: pagg_tab_ml_3.a - Filter: (avg(pagg_tab_ml_3.b) < '3'::numeric) + Group Key: pagg_tab_ml_5.a + Filter: (avg(pagg_tab_ml_5.b) < '3'::numeric) -> Sort - Sort Key: pagg_tab_ml_3.a + Sort Key: pagg_tab_ml_5.a -> Append - -> Seq Scan on pagg_tab_ml_p3_s1 pagg_tab_ml_3 - -> Seq Scan on pagg_tab_ml_p3_s2 pagg_tab_ml_4 + -> Seq Scan on pagg_tab_ml_p3_s1 pagg_tab_ml_5 + -> Seq Scan on pagg_tab_ml_p3_s2 pagg_tab_ml_6 -> GroupAggregate Group Key: pagg_tab_ml.a Filter: (avg(pagg_tab_ml.b) < '3'::numeric) @@ -1035,29 +1035,29 @@ SELECT a, sum(b), count(*) FROM pagg_tab_ml GROUP BY a HAVING avg(b) < 3 ORDER B Filter: (avg(pagg_tab_ml.b) < '3'::numeric) -> Seq Scan on pagg_tab_ml_p1 pagg_tab_ml -> Finalize GroupAggregate - Group Key: pagg_tab_ml_1.a - Filter: (avg(pagg_tab_ml_1.b) < '3'::numeric) + Group Key: pagg_tab_ml_2.a + Filter: (avg(pagg_tab_ml_2.b) < '3'::numeric) -> Sort - Sort Key: pagg_tab_ml_1.a + Sort Key: pagg_tab_ml_2.a -> Append - -> Partial HashAggregate - Group Key: pagg_tab_ml_1.a - -> Seq Scan on pagg_tab_ml_p2_s1 pagg_tab_ml_1 -> Partial HashAggregate Group Key: pagg_tab_ml_2.a - -> Seq Scan on pagg_tab_ml_p2_s2 pagg_tab_ml_2 - -> Finalize GroupAggregate - Group Key: pagg_tab_ml_3.a - Filter: (avg(pagg_tab_ml_3.b) < '3'::numeric) - -> Sort - Sort Key: pagg_tab_ml_3.a - -> Append + -> Seq Scan on pagg_tab_ml_p2_s1 pagg_tab_ml_2 -> Partial HashAggregate Group Key: pagg_tab_ml_3.a - -> Seq Scan on pagg_tab_ml_p3_s1 pagg_tab_ml_3 + -> Seq Scan on pagg_tab_ml_p2_s2 pagg_tab_ml_3 + -> Finalize GroupAggregate + Group Key: pagg_tab_ml_5.a + Filter: (avg(pagg_tab_ml_5.b) < '3'::numeric) + -> Sort + Sort Key: pagg_tab_ml_5.a + -> Append -> Partial HashAggregate - Group Key: pagg_tab_ml_4.a - -> Seq Scan on pagg_tab_ml_p3_s2 pagg_tab_ml_4 + Group Key: pagg_tab_ml_5.a + -> Seq Scan on pagg_tab_ml_p3_s1 pagg_tab_ml_5 + -> Partial HashAggregate + Group Key: pagg_tab_ml_6.a + -> Seq Scan on pagg_tab_ml_p3_s2 pagg_tab_ml_6 (31 rows) SELECT a, sum(b), count(*) FROM pagg_tab_ml GROUP BY a HAVING avg(b) < 3 ORDER BY 1, 2, 3; @@ -1185,33 +1185,33 @@ SELECT a, sum(b), count(*) FROM pagg_tab_ml GROUP BY a HAVING avg(b) < 3 ORDER B Group Key: pagg_tab_ml.a -> Parallel Seq Scan on pagg_tab_ml_p1 pagg_tab_ml -> Finalize GroupAggregate - Group Key: pagg_tab_ml_1.a - Filter: (avg(pagg_tab_ml_1.b) < '3'::numeric) + Group Key: pagg_tab_ml_2.a + Filter: (avg(pagg_tab_ml_2.b) < '3'::numeric) -> Gather Merge Workers Planned: 2 -> Sort - Sort Key: pagg_tab_ml_1.a + Sort Key: pagg_tab_ml_2.a -> Parallel Append - -> Partial HashAggregate - Group Key: pagg_tab_ml_1.a - -> Parallel Seq Scan on pagg_tab_ml_p2_s1 pagg_tab_ml_1 -> Partial HashAggregate Group Key: pagg_tab_ml_2.a - -> Parallel Seq Scan on pagg_tab_ml_p2_s2 pagg_tab_ml_2 + -> Parallel Seq Scan on pagg_tab_ml_p2_s1 pagg_tab_ml_2 + -> Partial HashAggregate + Group Key: pagg_tab_ml_3.a + -> Parallel Seq Scan on pagg_tab_ml_p2_s2 pagg_tab_ml_3 -> Finalize GroupAggregate - Group Key: pagg_tab_ml_3.a - Filter: (avg(pagg_tab_ml_3.b) < '3'::numeric) + Group Key: pagg_tab_ml_5.a + Filter: (avg(pagg_tab_ml_5.b) < '3'::numeric) -> Gather Merge Workers Planned: 2 -> Sort - Sort Key: pagg_tab_ml_3.a + Sort Key: pagg_tab_ml_5.a -> Parallel Append -> Partial HashAggregate - Group Key: pagg_tab_ml_3.a - -> Parallel Seq Scan on pagg_tab_ml_p3_s1 pagg_tab_ml_3 + Group Key: pagg_tab_ml_5.a + -> Parallel Seq Scan on pagg_tab_ml_p3_s1 pagg_tab_ml_5 -> Partial HashAggregate - Group Key: pagg_tab_ml_4.a - -> Parallel Seq Scan on pagg_tab_ml_p3_s2 pagg_tab_ml_4 + Group Key: pagg_tab_ml_6.a + -> Parallel Seq Scan on pagg_tab_ml_p3_s2 pagg_tab_ml_6 (41 rows) SELECT a, sum(b), count(*) FROM pagg_tab_ml GROUP BY a HAVING avg(b) < 3 ORDER BY 1, 2, 3; @@ -1426,9 +1426,9 @@ SELECT x, sum(y), avg(y), count(*) FROM pagg_tab_para GROUP BY x HAVING avg(y) < -> Partial HashAggregate Group Key: pagg_tab_para.x -> Parallel Append - -> Seq Scan on pagg_tab_para_p1 pagg_tab_para - -> Seq Scan on pagg_tab_para_p3 pagg_tab_para_2 - -> Parallel Seq Scan on pagg_tab_para_p2 pagg_tab_para_1 + -> Seq Scan on pagg_tab_para_p1 pagg_tab_para_1 + -> Seq Scan on pagg_tab_para_p3 pagg_tab_para_3 + -> Parallel Seq Scan on pagg_tab_para_p2 pagg_tab_para_2 (15 rows) SELECT x, sum(y), avg(y), count(*) FROM pagg_tab_para GROUP BY x HAVING avg(y) < 7 ORDER BY 1, 2, 3; @@ -1460,9 +1460,9 @@ SELECT x, sum(y), avg(y), count(*) FROM pagg_tab_para GROUP BY x HAVING avg(y) < -> Partial HashAggregate Group Key: pagg_tab_para.x -> Parallel Append - -> Seq Scan on pagg_tab_para_p1 pagg_tab_para - -> Seq Scan on pagg_tab_para_p2 pagg_tab_para_1 - -> Seq Scan on pagg_tab_para_p3 pagg_tab_para_2 + -> Seq Scan on pagg_tab_para_p1 pagg_tab_para_1 + -> Seq Scan on pagg_tab_para_p2 pagg_tab_para_2 + -> Seq Scan on pagg_tab_para_p3 pagg_tab_para_3 (15 rows) SELECT x, sum(y), avg(y), count(*) FROM pagg_tab_para GROUP BY x HAVING avg(y) < 7 ORDER BY 1, 2, 3; diff --git a/src/test/regress/expected/partition_join.out b/src/test/regress/expected/partition_join.out index 8e7127e586..8e475bf449 100644 --- a/src/test/regress/expected/partition_join.out +++ b/src/test/regress/expected/partition_join.out @@ -33,23 +33,23 @@ SELECT t1.a, t1.c, t2.b, t2.c FROM prt1 t1, prt2 t2 WHERE t1.a = t2.b AND t1.b = Sort Sort Key: t1.a -> Append - -> Hash Join - Hash Cond: (t2.b = t1.a) - -> Seq Scan on prt2_p1 t2 - -> Hash - -> Seq Scan on prt1_p1 t1 - Filter: (b = 0) -> Hash Join Hash Cond: (t2_1.b = t1_1.a) - -> Seq Scan on prt2_p2 t2_1 + -> Seq Scan on prt2_p1 t2_1 -> Hash - -> Seq Scan on prt1_p2 t1_1 + -> Seq Scan on prt1_p1 t1_1 Filter: (b = 0) -> Hash Join Hash Cond: (t2_2.b = t1_2.a) - -> Seq Scan on prt2_p3 t2_2 + -> Seq Scan on prt2_p2 t2_2 -> Hash - -> Seq Scan on prt1_p3 t1_2 + -> Seq Scan on prt1_p2 t1_2 + Filter: (b = 0) + -> Hash Join + Hash Cond: (t2_3.b = t1_3.a) + -> Seq Scan on prt2_p3 t2_3 + -> Hash + -> Seq Scan on prt1_p3 t1_3 Filter: (b = 0) (21 rows) @@ -72,16 +72,16 @@ SELECT t1, t2 FROM prt1 t1 LEFT JOIN prt2 t2 ON t1.a = t2.b WHERE t1.b = 0 ORDER -> Hash Right Join Hash Cond: (t2.b = t1.a) -> Append - -> Seq Scan on prt2_p1 t2 - -> Seq Scan on prt2_p2 t2_1 - -> Seq Scan on prt2_p3 t2_2 + -> Seq Scan on prt2_p1 t2_1 + -> Seq Scan on prt2_p2 t2_2 + -> Seq Scan on prt2_p3 t2_3 -> Hash -> Append - -> Seq Scan on prt1_p1 t1 + -> Seq Scan on prt1_p1 t1_1 Filter: (b = 0) - -> Seq Scan on prt1_p2 t1_1 + -> Seq Scan on prt1_p2 t1_2 Filter: (b = 0) - -> Seq Scan on prt1_p3 t1_2 + -> Seq Scan on prt1_p3 t1_3 Filter: (b = 0) (16 rows) @@ -111,22 +111,22 @@ SELECT t1.a, t1.c, t2.b, t2.c FROM prt1 t1 RIGHT JOIN prt2 t2 ON t1.a = t2.b WHE Sort Key: t1.a, t2.b -> Append -> Hash Right Join - Hash Cond: (t1.a = t2.b) - -> Seq Scan on prt1_p1 t1 + Hash Cond: (t1_1.a = t2_1.b) + -> Seq Scan on prt1_p1 t1_1 -> Hash - -> Seq Scan on prt2_p1 t2 + -> Seq Scan on prt2_p1 t2_1 Filter: (a = 0) -> Hash Right Join - Hash Cond: (t1_1.a = t2_1.b) - -> Seq Scan on prt1_p2 t1_1 + Hash Cond: (t1_2.a = t2_2.b) + -> Seq Scan on prt1_p2 t1_2 -> Hash - -> Seq Scan on prt2_p2 t2_1 + -> Seq Scan on prt2_p2 t2_2 Filter: (a = 0) -> Nested Loop Left Join - -> Seq Scan on prt2_p3 t2_2 + -> Seq Scan on prt2_p3 t2_3 Filter: (a = 0) - -> Index Scan using iprt1_p3_a on prt1_p3 t1_2 - Index Cond: (a = t2_2.b) + -> Index Scan using iprt1_p3_a on prt1_p3 t1_3 + Index Cond: (a = t2_3.b) (20 rows) SELECT t1.a, t1.c, t2.b, t2.c FROM prt1 t1 RIGHT JOIN prt2 t2 ON t1.a = t2.b WHERE t2.a = 0 ORDER BY t1.a, t2.b; @@ -150,29 +150,29 @@ SELECT t1.a, t1.c, t2.b, t2.c FROM (SELECT 50 phv, * FROM prt1 WHERE prt1.b = 0) Sort Sort Key: prt1.a, prt2.b -> Append - -> Hash Full Join - Hash Cond: (prt1.a = prt2.b) - Filter: (((50) = prt1.a) OR ((75) = prt2.b)) - -> Seq Scan on prt1_p1 prt1 - Filter: (b = 0) - -> Hash - -> Seq Scan on prt2_p1 prt2 - Filter: (a = 0) -> Hash Full Join Hash Cond: (prt1_1.a = prt2_1.b) Filter: (((50) = prt1_1.a) OR ((75) = prt2_1.b)) - -> Seq Scan on prt1_p2 prt1_1 + -> Seq Scan on prt1_p1 prt1_1 Filter: (b = 0) -> Hash - -> Seq Scan on prt2_p2 prt2_1 + -> Seq Scan on prt2_p1 prt2_1 Filter: (a = 0) -> Hash Full Join Hash Cond: (prt1_2.a = prt2_2.b) Filter: (((50) = prt1_2.a) OR ((75) = prt2_2.b)) - -> Seq Scan on prt1_p3 prt1_2 + -> Seq Scan on prt1_p2 prt1_2 Filter: (b = 0) -> Hash - -> Seq Scan on prt2_p3 prt2_2 + -> Seq Scan on prt2_p2 prt2_2 + Filter: (a = 0) + -> Hash Full Join + Hash Cond: (prt1_3.a = prt2_3.b) + Filter: (((50) = prt1_3.a) OR ((75) = prt2_3.b)) + -> Seq Scan on prt1_p3 prt1_3 + Filter: (b = 0) + -> Hash + -> Seq Scan on prt2_p3 prt2_3 Filter: (a = 0) (27 rows) @@ -215,15 +215,15 @@ SELECT t1.a, t1.c, t2.b, t2.c FROM (SELECT * FROM prt1 WHERE a < 450) t1 LEFT JO -> Hash Right Join Hash Cond: (prt2.b = prt1.a) -> Append - -> Seq Scan on prt2_p2 prt2 + -> Seq Scan on prt2_p2 prt2_1 Filter: (b > 250) - -> Seq Scan on prt2_p3 prt2_1 + -> Seq Scan on prt2_p3 prt2_2 Filter: (b > 250) -> Hash -> Append - -> Seq Scan on prt1_p1 prt1 + -> Seq Scan on prt1_p1 prt1_1 Filter: ((a < 450) AND (b = 0)) - -> Seq Scan on prt1_p2 prt1_1 + -> Seq Scan on prt1_p2 prt1_2 Filter: ((a < 450) AND (b = 0)) (15 rows) @@ -252,15 +252,15 @@ SELECT t1.a, t1.c, t2.b, t2.c FROM (SELECT * FROM prt1 WHERE a < 450) t1 FULL JO Hash Cond: (prt1.a = prt2.b) Filter: ((prt1.b = 0) OR (prt2.a = 0)) -> Append - -> Seq Scan on prt1_p1 prt1 + -> Seq Scan on prt1_p1 prt1_1 Filter: (a < 450) - -> Seq Scan on prt1_p2 prt1_1 + -> Seq Scan on prt1_p2 prt1_2 Filter: (a < 450) -> Hash -> Append - -> Seq Scan on prt2_p2 prt2 + -> Seq Scan on prt2_p2 prt2_1 Filter: (b > 250) - -> Seq Scan on prt2_p3 prt2_1 + -> Seq Scan on prt2_p3 prt2_2 Filter: (b > 250) (16 rows) @@ -290,25 +290,25 @@ SELECT t1.* FROM prt1 t1 WHERE t1.a IN (SELECT t2.b FROM prt2 t2 WHERE t2.a = 0) Sort Key: t1.a -> Append -> Hash Semi Join - Hash Cond: (t1.a = t2.b) - -> Seq Scan on prt1_p1 t1 + Hash Cond: (t1_1.a = t2_1.b) + -> Seq Scan on prt1_p1 t1_1 Filter: (b = 0) -> Hash - -> Seq Scan on prt2_p1 t2 + -> Seq Scan on prt2_p1 t2_1 Filter: (a = 0) -> Hash Semi Join - Hash Cond: (t1_1.a = t2_1.b) - -> Seq Scan on prt1_p2 t1_1 + Hash Cond: (t1_2.a = t2_2.b) + -> Seq Scan on prt1_p2 t1_2 Filter: (b = 0) -> Hash - -> Seq Scan on prt2_p2 t2_1 + -> Seq Scan on prt2_p2 t2_2 Filter: (a = 0) -> Nested Loop Semi Join - Join Filter: (t1_2.a = t2_2.b) - -> Seq Scan on prt1_p3 t1_2 + Join Filter: (t1_3.a = t2_3.b) + -> Seq Scan on prt1_p3 t1_3 Filter: (b = 0) -> Materialize - -> Seq Scan on prt2_p3 t2_2 + -> Seq Scan on prt2_p3 t2_3 Filter: (a = 0) (24 rows) @@ -328,21 +328,21 @@ SELECT sum(t1.a), avg(t1.a), sum(t1.b), avg(t1.b) FROM prt1 t1 WHERE NOT EXISTS -------------------------------------------------- Aggregate -> Append - -> Hash Anti Join - Hash Cond: (t1.a = t2.b) - -> Seq Scan on prt1_p1 t1 - -> Hash - -> Seq Scan on prt2_p1 t2 -> Hash Anti Join Hash Cond: (t1_1.a = t2_1.b) - -> Seq Scan on prt1_p2 t1_1 + -> Seq Scan on prt1_p1 t1_1 -> Hash - -> Seq Scan on prt2_p2 t2_1 + -> Seq Scan on prt2_p1 t2_1 -> Hash Anti Join Hash Cond: (t1_2.a = t2_2.b) - -> Seq Scan on prt1_p3 t1_2 + -> Seq Scan on prt1_p2 t1_2 -> Hash - -> Seq Scan on prt2_p3 t2_2 + -> Seq Scan on prt2_p2 t2_2 + -> Hash Anti Join + Hash Cond: (t1_3.a = t2_3.b) + -> Seq Scan on prt1_p3 t1_3 + -> Hash + -> Seq Scan on prt2_p3 t2_3 (17 rows) SELECT sum(t1.a), avg(t1.a), sum(t1.b), avg(t1.b) FROM prt1 t1 WHERE NOT EXISTS (SELECT 1 FROM prt2 t2 WHERE t1.a = t2.b); @@ -362,29 +362,29 @@ SELECT * FROM prt1 t1 LEFT JOIN LATERAL Sort Key: t1.a -> Append -> Nested Loop Left Join - -> Seq Scan on prt1_p1 t1 + -> Seq Scan on prt1_p1 t1_1 Filter: (b = 0) -> Nested Loop - -> Index Only Scan using iprt1_p1_a on prt1_p1 t2 - Index Cond: (a = t1.a) - -> Index Scan using iprt2_p1_b on prt2_p1 t3 - Index Cond: (b = t2.a) - -> Nested Loop Left Join - -> Seq Scan on prt1_p2 t1_1 - Filter: (b = 0) - -> Nested Loop - -> Index Only Scan using iprt1_p2_a on prt1_p2 t2_1 + -> Index Only Scan using iprt1_p1_a on prt1_p1 t2_1 Index Cond: (a = t1_1.a) - -> Index Scan using iprt2_p2_b on prt2_p2 t3_1 + -> Index Scan using iprt2_p1_b on prt2_p1 t3_1 Index Cond: (b = t2_1.a) -> Nested Loop Left Join - -> Seq Scan on prt1_p3 t1_2 + -> Seq Scan on prt1_p2 t1_2 Filter: (b = 0) -> Nested Loop - -> Index Only Scan using iprt1_p3_a on prt1_p3 t2_2 + -> Index Only Scan using iprt1_p2_a on prt1_p2 t2_2 Index Cond: (a = t1_2.a) - -> Index Scan using iprt2_p3_b on prt2_p3 t3_2 + -> Index Scan using iprt2_p2_b on prt2_p2 t3_2 Index Cond: (b = t2_2.a) + -> Nested Loop Left Join + -> Seq Scan on prt1_p3 t1_3 + Filter: (b = 0) + -> Nested Loop + -> Index Only Scan using iprt1_p3_a on prt1_p3 t2_3 + Index Cond: (a = t1_3.a) + -> Index Scan using iprt2_p3_b on prt2_p3 t3_3 + Index Cond: (b = t2_3.a) (27 rows) SELECT * FROM prt1 t1 LEFT JOIN LATERAL @@ -418,26 +418,26 @@ SELECT t1.a, ss.t2a, ss.t2c FROM prt1 t1 LEFT JOIN LATERAL Hash Cond: ((t1.c)::text = (t2.c)::text) Filter: ((t1.b + COALESCE(t2.b, 0)) = 0) -> Append - -> Seq Scan on prt1_p1 t1 - -> Seq Scan on prt1_p2 t1_1 - -> Seq Scan on prt1_p3 t1_2 + -> Seq Scan on prt1_p1 t1_1 + -> Seq Scan on prt1_p2 t1_2 + -> Seq Scan on prt1_p3 t1_3 -> Hash -> Append - -> Hash Join - Hash Cond: (t2.a = t3.b) - -> Seq Scan on prt1_p1 t2 - -> Hash - -> Seq Scan on prt2_p1 t3 -> Hash Join Hash Cond: (t2_1.a = t3_1.b) - -> Seq Scan on prt1_p2 t2_1 + -> Seq Scan on prt1_p1 t2_1 -> Hash - -> Seq Scan on prt2_p2 t3_1 + -> Seq Scan on prt2_p1 t3_1 -> Hash Join Hash Cond: (t2_2.a = t3_2.b) - -> Seq Scan on prt1_p3 t2_2 + -> Seq Scan on prt1_p2 t2_2 -> Hash - -> Seq Scan on prt2_p3 t3_2 + -> Seq Scan on prt2_p2 t3_2 + -> Hash Join + Hash Cond: (t2_3.a = t3_3.b) + -> Seq Scan on prt1_p3 t2_3 + -> Hash + -> Seq Scan on prt2_p3 t3_3 (26 rows) SELECT t1.a, ss.t2a, ss.t2c FROM prt1 t1 LEFT JOIN LATERAL @@ -561,23 +561,23 @@ SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_e t1, prt2_e t2 WHERE (t1.a + t1.b)/2 = Sort Sort Key: t1.a, t2.b -> Append - -> Hash Join - Hash Cond: (((t2.b + t2.a) / 2) = ((t1.a + t1.b) / 2)) - -> Seq Scan on prt2_e_p1 t2 - -> Hash - -> Seq Scan on prt1_e_p1 t1 - Filter: (c = 0) -> Hash Join Hash Cond: (((t2_1.b + t2_1.a) / 2) = ((t1_1.a + t1_1.b) / 2)) - -> Seq Scan on prt2_e_p2 t2_1 + -> Seq Scan on prt2_e_p1 t2_1 -> Hash - -> Seq Scan on prt1_e_p2 t1_1 + -> Seq Scan on prt1_e_p1 t1_1 Filter: (c = 0) -> Hash Join Hash Cond: (((t2_2.b + t2_2.a) / 2) = ((t1_2.a + t1_2.b) / 2)) - -> Seq Scan on prt2_e_p3 t2_2 + -> Seq Scan on prt2_e_p2 t2_2 -> Hash - -> Seq Scan on prt1_e_p3 t1_2 + -> Seq Scan on prt1_e_p2 t1_2 + Filter: (c = 0) + -> Hash Join + Hash Cond: (((t2_3.b + t2_3.a) / 2) = ((t1_3.a + t1_3.b) / 2)) + -> Seq Scan on prt2_e_p3 t2_3 + -> Hash + -> Seq Scan on prt1_e_p3 t1_3 Filter: (c = 0) (21 rows) @@ -600,36 +600,36 @@ SELECT t1.a, t1.c, t2.b, t2.c, t3.a + t3.b, t3.c FROM prt1 t1, prt2 t2, prt1_e t Sort Sort Key: t1.a -> Append - -> Nested Loop - Join Filter: (t1.a = ((t3.a + t3.b) / 2)) - -> Hash Join - Hash Cond: (t2.b = t1.a) - -> Seq Scan on prt2_p1 t2 - -> Hash - -> Seq Scan on prt1_p1 t1 - Filter: (b = 0) - -> Index Scan using iprt1_e_p1_ab2 on prt1_e_p1 t3 - Index Cond: (((a + b) / 2) = t2.b) -> Nested Loop Join Filter: (t1_1.a = ((t3_1.a + t3_1.b) / 2)) -> Hash Join Hash Cond: (t2_1.b = t1_1.a) - -> Seq Scan on prt2_p2 t2_1 + -> Seq Scan on prt2_p1 t2_1 -> Hash - -> Seq Scan on prt1_p2 t1_1 + -> Seq Scan on prt1_p1 t1_1 Filter: (b = 0) - -> Index Scan using iprt1_e_p2_ab2 on prt1_e_p2 t3_1 + -> Index Scan using iprt1_e_p1_ab2 on prt1_e_p1 t3_1 Index Cond: (((a + b) / 2) = t2_1.b) -> Nested Loop Join Filter: (t1_2.a = ((t3_2.a + t3_2.b) / 2)) -> Hash Join Hash Cond: (t2_2.b = t1_2.a) - -> Seq Scan on prt2_p3 t2_2 + -> Seq Scan on prt2_p2 t2_2 -> Hash - -> Seq Scan on prt1_p3 t1_2 + -> Seq Scan on prt1_p2 t1_2 Filter: (b = 0) - -> Index Scan using iprt1_e_p3_ab2 on prt1_e_p3 t3_2 + -> Index Scan using iprt1_e_p2_ab2 on prt1_e_p2 t3_2 Index Cond: (((a + b) / 2) = t2_2.b) + -> Nested Loop + Join Filter: (t1_3.a = ((t3_3.a + t3_3.b) / 2)) + -> Hash Join + Hash Cond: (t2_3.b = t1_3.a) + -> Seq Scan on prt2_p3 t2_3 + -> Hash + -> Seq Scan on prt1_p3 t1_3 + Filter: (b = 0) + -> Index Scan using iprt1_e_p3_ab2 on prt1_e_p3 t3_3 + Index Cond: (((a + b) / 2) = t2_3.b) (33 rows) SELECT t1.a, t1.c, t2.b, t2.c, t3.a + t3.b, t3.c FROM prt1 t1, prt2 t2, prt1_e t3 WHERE t1.a = t2.b AND t1.a = (t3.a + t3.b)/2 AND t1.b = 0 ORDER BY t1.a, t2.b; @@ -648,35 +648,35 @@ SELECT t1.a, t1.c, t2.b, t2.c, t3.a + t3.b, t3.c FROM (prt1 t1 LEFT JOIN prt2 t2 Sort Sort Key: t1.a, t2.b, ((t3.a + t3.b)) -> Append - -> Hash Right Join - Hash Cond: (((t3.a + t3.b) / 2) = t1.a) - -> Seq Scan on prt1_e_p1 t3 - -> Hash - -> Hash Right Join - Hash Cond: (t2.b = t1.a) - -> Seq Scan on prt2_p1 t2 - -> Hash - -> Seq Scan on prt1_p1 t1 - Filter: (b = 0) -> Hash Right Join Hash Cond: (((t3_1.a + t3_1.b) / 2) = t1_1.a) - -> Seq Scan on prt1_e_p2 t3_1 + -> Seq Scan on prt1_e_p1 t3_1 -> Hash -> Hash Right Join Hash Cond: (t2_1.b = t1_1.a) - -> Seq Scan on prt2_p2 t2_1 + -> Seq Scan on prt2_p1 t2_1 -> Hash - -> Seq Scan on prt1_p2 t1_1 + -> Seq Scan on prt1_p1 t1_1 Filter: (b = 0) -> Hash Right Join Hash Cond: (((t3_2.a + t3_2.b) / 2) = t1_2.a) - -> Seq Scan on prt1_e_p3 t3_2 + -> Seq Scan on prt1_e_p2 t3_2 -> Hash -> Hash Right Join Hash Cond: (t2_2.b = t1_2.a) - -> Seq Scan on prt2_p3 t2_2 + -> Seq Scan on prt2_p2 t2_2 -> Hash - -> Seq Scan on prt1_p3 t1_2 + -> Seq Scan on prt1_p2 t1_2 + Filter: (b = 0) + -> Hash Right Join + Hash Cond: (((t3_3.a + t3_3.b) / 2) = t1_3.a) + -> Seq Scan on prt1_e_p3 t3_3 + -> Hash + -> Hash Right Join + Hash Cond: (t2_3.b = t1_3.a) + -> Seq Scan on prt2_p3 t2_3 + -> Hash + -> Seq Scan on prt1_p3 t1_3 Filter: (b = 0) (33 rows) @@ -704,33 +704,33 @@ SELECT t1.a, t1.c, t2.b, t2.c, t3.a + t3.b, t3.c FROM (prt1 t1 LEFT JOIN prt2 t2 Sort Sort Key: t1.a, t2.b, ((t3.a + t3.b)) -> Append - -> Nested Loop Left Join - -> Hash Right Join - Hash Cond: (t1.a = ((t3.a + t3.b) / 2)) - -> Seq Scan on prt1_p1 t1 - -> Hash - -> Seq Scan on prt1_e_p1 t3 - Filter: (c = 0) - -> Index Scan using iprt2_p1_b on prt2_p1 t2 - Index Cond: (b = t1.a) -> Nested Loop Left Join -> Hash Right Join Hash Cond: (t1_1.a = ((t3_1.a + t3_1.b) / 2)) - -> Seq Scan on prt1_p2 t1_1 + -> Seq Scan on prt1_p1 t1_1 -> Hash - -> Seq Scan on prt1_e_p2 t3_1 + -> Seq Scan on prt1_e_p1 t3_1 Filter: (c = 0) - -> Index Scan using iprt2_p2_b on prt2_p2 t2_1 + -> Index Scan using iprt2_p1_b on prt2_p1 t2_1 Index Cond: (b = t1_1.a) -> Nested Loop Left Join -> Hash Right Join Hash Cond: (t1_2.a = ((t3_2.a + t3_2.b) / 2)) - -> Seq Scan on prt1_p3 t1_2 + -> Seq Scan on prt1_p2 t1_2 -> Hash - -> Seq Scan on prt1_e_p3 t3_2 + -> Seq Scan on prt1_e_p2 t3_2 Filter: (c = 0) - -> Index Scan using iprt2_p3_b on prt2_p3 t2_2 + -> Index Scan using iprt2_p2_b on prt2_p2 t2_2 Index Cond: (b = t1_2.a) + -> Nested Loop Left Join + -> Hash Right Join + Hash Cond: (t1_3.a = ((t3_3.a + t3_3.b) / 2)) + -> Seq Scan on prt1_p3 t1_3 + -> Hash + -> Seq Scan on prt1_e_p3 t3_3 + Filter: (c = 0) + -> Index Scan using iprt2_p3_b on prt2_p3 t2_3 + Index Cond: (b = t1_3.a) (30 rows) SELECT t1.a, t1.c, t2.b, t2.c, t3.a + t3.b, t3.c FROM (prt1 t1 LEFT JOIN prt2 t2 ON t1.a = t2.b) RIGHT JOIN prt1_e t3 ON (t1.a = (t3.a + t3.b)/2) WHERE t3.c = 0 ORDER BY t1.a, t2.b, t3.a + t3.b; @@ -759,44 +759,44 @@ SELECT t1.a, t1.phv, t2.b, t2.phv, t3.a + t3.b, t3.phv FROM ((SELECT 50 phv, * F Sort Sort Key: prt1.a, prt2.b, ((prt1_e.a + prt1_e.b)) -> Append - -> Hash Full Join - Hash Cond: (prt1.a = ((prt1_e.a + prt1_e.b) / 2)) - Filter: ((prt1.a = (50)) OR (prt2.b = (75)) OR (((prt1_e.a + prt1_e.b) / 2) = (50))) - -> Hash Full Join - Hash Cond: (prt1.a = prt2.b) - -> Seq Scan on prt1_p1 prt1 - Filter: (b = 0) - -> Hash - -> Seq Scan on prt2_p1 prt2 - Filter: (a = 0) - -> Hash - -> Seq Scan on prt1_e_p1 prt1_e - Filter: (c = 0) -> Hash Full Join Hash Cond: (prt1_1.a = ((prt1_e_1.a + prt1_e_1.b) / 2)) Filter: ((prt1_1.a = (50)) OR (prt2_1.b = (75)) OR (((prt1_e_1.a + prt1_e_1.b) / 2) = (50))) -> Hash Full Join Hash Cond: (prt1_1.a = prt2_1.b) - -> Seq Scan on prt1_p2 prt1_1 + -> Seq Scan on prt1_p1 prt1_1 Filter: (b = 0) -> Hash - -> Seq Scan on prt2_p2 prt2_1 + -> Seq Scan on prt2_p1 prt2_1 Filter: (a = 0) -> Hash - -> Seq Scan on prt1_e_p2 prt1_e_1 + -> Seq Scan on prt1_e_p1 prt1_e_1 Filter: (c = 0) -> Hash Full Join Hash Cond: (prt1_2.a = ((prt1_e_2.a + prt1_e_2.b) / 2)) Filter: ((prt1_2.a = (50)) OR (prt2_2.b = (75)) OR (((prt1_e_2.a + prt1_e_2.b) / 2) = (50))) -> Hash Full Join Hash Cond: (prt1_2.a = prt2_2.b) - -> Seq Scan on prt1_p3 prt1_2 + -> Seq Scan on prt1_p2 prt1_2 Filter: (b = 0) -> Hash - -> Seq Scan on prt2_p3 prt2_2 + -> Seq Scan on prt2_p2 prt2_2 Filter: (a = 0) -> Hash - -> Seq Scan on prt1_e_p3 prt1_e_2 + -> Seq Scan on prt1_e_p2 prt1_e_2 + Filter: (c = 0) + -> Hash Full Join + Hash Cond: (prt1_3.a = ((prt1_e_3.a + prt1_e_3.b) / 2)) + Filter: ((prt1_3.a = (50)) OR (prt2_3.b = (75)) OR (((prt1_e_3.a + prt1_e_3.b) / 2) = (50))) + -> Hash Full Join + Hash Cond: (prt1_3.a = prt2_3.b) + -> Seq Scan on prt1_p3 prt1_3 + Filter: (b = 0) + -> Hash + -> Seq Scan on prt2_p3 prt2_3 + Filter: (a = 0) + -> Hash + -> Seq Scan on prt1_e_p3 prt1_e_3 Filter: (c = 0) (42 rows) @@ -815,44 +815,44 @@ SELECT t1.* FROM prt1 t1 WHERE t1.a IN (SELECT t1.b FROM prt2 t1, prt1_e t2 WHER Sort Sort Key: t1.a -> Append - -> Nested Loop - Join Filter: (t1.a = t1_3.b) - -> HashAggregate - Group Key: t1_3.b - -> Hash Join - Hash Cond: (((t2.a + t2.b) / 2) = t1_3.b) - -> Seq Scan on prt1_e_p1 t2 - -> Hash - -> Seq Scan on prt2_p1 t1_3 - Filter: (a = 0) - -> Index Scan using iprt1_p1_a on prt1_p1 t1 - Index Cond: (a = ((t2.a + t2.b) / 2)) - Filter: (b = 0) - -> Nested Loop - Join Filter: (t1_1.a = t1_4.b) - -> HashAggregate - Group Key: t1_4.b - -> Hash Join - Hash Cond: (((t2_1.a + t2_1.b) / 2) = t1_4.b) - -> Seq Scan on prt1_e_p2 t2_1 - -> Hash - -> Seq Scan on prt2_p2 t1_4 - Filter: (a = 0) - -> Index Scan using iprt1_p2_a on prt1_p2 t1_1 - Index Cond: (a = ((t2_1.a + t2_1.b) / 2)) - Filter: (b = 0) -> Nested Loop Join Filter: (t1_2.a = t1_5.b) -> HashAggregate Group Key: t1_5.b - -> Nested Loop - -> Seq Scan on prt2_p3 t1_5 - Filter: (a = 0) - -> Index Scan using iprt1_e_p3_ab2 on prt1_e_p3 t2_2 - Index Cond: (((a + b) / 2) = t1_5.b) - -> Index Scan using iprt1_p3_a on prt1_p3 t1_2 + -> Hash Join + Hash Cond: (((t2_1.a + t2_1.b) / 2) = t1_5.b) + -> Seq Scan on prt1_e_p1 t2_1 + -> Hash + -> Seq Scan on prt2_p1 t1_5 + Filter: (a = 0) + -> Index Scan using iprt1_p1_a on prt1_p1 t1_2 + Index Cond: (a = ((t2_1.a + t2_1.b) / 2)) + Filter: (b = 0) + -> Nested Loop + Join Filter: (t1_3.a = t1_6.b) + -> HashAggregate + Group Key: t1_6.b + -> Hash Join + Hash Cond: (((t2_2.a + t2_2.b) / 2) = t1_6.b) + -> Seq Scan on prt1_e_p2 t2_2 + -> Hash + -> Seq Scan on prt2_p2 t1_6 + Filter: (a = 0) + -> Index Scan using iprt1_p2_a on prt1_p2 t1_3 Index Cond: (a = ((t2_2.a + t2_2.b) / 2)) Filter: (b = 0) + -> Nested Loop + Join Filter: (t1_4.a = t1_7.b) + -> HashAggregate + Group Key: t1_7.b + -> Nested Loop + -> Seq Scan on prt2_p3 t1_7 + Filter: (a = 0) + -> Index Scan using iprt1_e_p3_ab2 on prt1_e_p3 t2_3 + Index Cond: (((a + b) / 2) = t1_7.b) + -> Index Scan using iprt1_p3_a on prt1_p3 t1_4 + Index Cond: (a = ((t2_3.a + t2_3.b) / 2)) + Filter: (b = 0) (41 rows) SELECT t1.* FROM prt1 t1 WHERE t1.a IN (SELECT t1.b FROM prt2 t1, prt1_e t2 WHERE t1.a = 0 AND t1.b = (t2.a + t2.b)/2) AND t1.b = 0 ORDER BY t1.a; @@ -866,46 +866,46 @@ SELECT t1.* FROM prt1 t1 WHERE t1.a IN (SELECT t1.b FROM prt2 t1, prt1_e t2 WHER EXPLAIN (COSTS OFF) SELECT t1.* FROM prt1 t1 WHERE t1.a IN (SELECT t1.b FROM prt2 t1 WHERE t1.b IN (SELECT (t1.a + t1.b)/2 FROM prt1_e t1 WHERE t1.c = 0)) AND t1.b = 0 ORDER BY t1.a; - QUERY PLAN -------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------- Sort Sort Key: t1.a -> Append -> Nested Loop -> HashAggregate - Group Key: t1_3.b + Group Key: t1_6.b -> Hash Semi Join - Hash Cond: (t1_3.b = ((t1_6.a + t1_6.b) / 2)) - -> Seq Scan on prt2_p1 t1_3 + Hash Cond: (t1_6.b = ((t1_9.a + t1_9.b) / 2)) + -> Seq Scan on prt2_p1 t1_6 -> Hash - -> Seq Scan on prt1_e_p1 t1_6 + -> Seq Scan on prt1_e_p1 t1_9 Filter: (c = 0) - -> Index Scan using iprt1_p1_a on prt1_p1 t1 - Index Cond: (a = t1_3.b) + -> Index Scan using iprt1_p1_a on prt1_p1 t1_3 + Index Cond: (a = t1_6.b) Filter: (b = 0) -> Nested Loop -> HashAggregate - Group Key: t1_4.b + Group Key: t1_7.b -> Hash Semi Join - Hash Cond: (t1_4.b = ((t1_7.a + t1_7.b) / 2)) - -> Seq Scan on prt2_p2 t1_4 + Hash Cond: (t1_7.b = ((t1_10.a + t1_10.b) / 2)) + -> Seq Scan on prt2_p2 t1_7 -> Hash - -> Seq Scan on prt1_e_p2 t1_7 + -> Seq Scan on prt1_e_p2 t1_10 Filter: (c = 0) - -> Index Scan using iprt1_p2_a on prt1_p2 t1_1 - Index Cond: (a = t1_4.b) + -> Index Scan using iprt1_p2_a on prt1_p2 t1_4 + Index Cond: (a = t1_7.b) Filter: (b = 0) -> Nested Loop -> HashAggregate - Group Key: t1_5.b + Group Key: t1_8.b -> Hash Semi Join - Hash Cond: (t1_5.b = ((t1_8.a + t1_8.b) / 2)) - -> Seq Scan on prt2_p3 t1_5 + Hash Cond: (t1_8.b = ((t1_11.a + t1_11.b) / 2)) + -> Seq Scan on prt2_p3 t1_8 -> Hash - -> Seq Scan on prt1_e_p3 t1_8 + -> Seq Scan on prt1_e_p3 t1_11 Filter: (c = 0) - -> Index Scan using iprt1_p3_a on prt1_p3 t1_2 - Index Cond: (a = t1_5.b) + -> Index Scan using iprt1_p3_a on prt1_p3 t1_5 + Index Cond: (a = t1_8.b) Filter: (b = 0) (39 rows) @@ -923,54 +923,54 @@ SET enable_hashjoin TO off; SET enable_nestloop TO off; EXPLAIN (COSTS OFF) SELECT t1.* FROM prt1 t1 WHERE t1.a IN (SELECT t1.b FROM prt2 t1 WHERE t1.b IN (SELECT (t1.a + t1.b)/2 FROM prt1_e t1 WHERE t1.c = 0)) AND t1.b = 0 ORDER BY t1.a; - QUERY PLAN ----------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------ Merge Append Sort Key: t1.a -> Merge Semi Join - Merge Cond: (t1.a = t1_3.b) + Merge Cond: (t1_3.a = t1_6.b) -> Sort - Sort Key: t1.a - -> Seq Scan on prt1_p1 t1 + Sort Key: t1_3.a + -> Seq Scan on prt1_p1 t1_3 Filter: (b = 0) -> Merge Semi Join - Merge Cond: (t1_3.b = (((t1_6.a + t1_6.b) / 2))) + Merge Cond: (t1_6.b = (((t1_9.a + t1_9.b) / 2))) -> Sort - Sort Key: t1_3.b - -> Seq Scan on prt2_p1 t1_3 + Sort Key: t1_6.b + -> Seq Scan on prt2_p1 t1_6 -> Sort - Sort Key: (((t1_6.a + t1_6.b) / 2)) - -> Seq Scan on prt1_e_p1 t1_6 + Sort Key: (((t1_9.a + t1_9.b) / 2)) + -> Seq Scan on prt1_e_p1 t1_9 Filter: (c = 0) -> Merge Semi Join - Merge Cond: (t1_1.a = t1_4.b) + Merge Cond: (t1_4.a = t1_7.b) -> Sort - Sort Key: t1_1.a - -> Seq Scan on prt1_p2 t1_1 + Sort Key: t1_4.a + -> Seq Scan on prt1_p2 t1_4 Filter: (b = 0) -> Merge Semi Join - Merge Cond: (t1_4.b = (((t1_7.a + t1_7.b) / 2))) + Merge Cond: (t1_7.b = (((t1_10.a + t1_10.b) / 2))) -> Sort - Sort Key: t1_4.b - -> Seq Scan on prt2_p2 t1_4 + Sort Key: t1_7.b + -> Seq Scan on prt2_p2 t1_7 -> Sort - Sort Key: (((t1_7.a + t1_7.b) / 2)) - -> Seq Scan on prt1_e_p2 t1_7 + Sort Key: (((t1_10.a + t1_10.b) / 2)) + -> Seq Scan on prt1_e_p2 t1_10 Filter: (c = 0) -> Merge Semi Join - Merge Cond: (t1_2.a = t1_5.b) + Merge Cond: (t1_5.a = t1_8.b) -> Sort - Sort Key: t1_2.a - -> Seq Scan on prt1_p3 t1_2 + Sort Key: t1_5.a + -> Seq Scan on prt1_p3 t1_5 Filter: (b = 0) -> Merge Semi Join - Merge Cond: (t1_5.b = (((t1_8.a + t1_8.b) / 2))) + Merge Cond: (t1_8.b = (((t1_11.a + t1_11.b) / 2))) -> Sort - Sort Key: t1_5.b - -> Seq Scan on prt2_p3 t1_5 + Sort Key: t1_8.b + -> Seq Scan on prt2_p3 t1_8 -> Sort - Sort Key: (((t1_8.a + t1_8.b) / 2)) - -> Seq Scan on prt1_e_p3 t1_8 + Sort Key: (((t1_11.a + t1_11.b) / 2)) + -> Seq Scan on prt1_e_p3 t1_11 Filter: (c = 0) (47 rows) @@ -990,22 +990,6 @@ SELECT t1.a, t1.c, t2.b, t2.c, t3.a + t3.b, t3.c FROM (prt1 t1 LEFT JOIN prt2 t2 Sort Sort Key: t1.a, t2.b, ((t3.a + t3.b)) -> Append - -> Merge Left Join - Merge Cond: (t1.a = t2.b) - -> Sort - Sort Key: t1.a - -> Merge Left Join - Merge Cond: ((((t3.a + t3.b) / 2)) = t1.a) - -> Sort - Sort Key: (((t3.a + t3.b) / 2)) - -> Seq Scan on prt1_e_p1 t3 - Filter: (c = 0) - -> Sort - Sort Key: t1.a - -> Seq Scan on prt1_p1 t1 - -> Sort - Sort Key: t2.b - -> Seq Scan on prt2_p1 t2 -> Merge Left Join Merge Cond: (t1_1.a = t2_1.b) -> Sort @@ -1014,14 +998,14 @@ SELECT t1.a, t1.c, t2.b, t2.c, t3.a + t3.b, t3.c FROM (prt1 t1 LEFT JOIN prt2 t2 Merge Cond: ((((t3_1.a + t3_1.b) / 2)) = t1_1.a) -> Sort Sort Key: (((t3_1.a + t3_1.b) / 2)) - -> Seq Scan on prt1_e_p2 t3_1 + -> Seq Scan on prt1_e_p1 t3_1 Filter: (c = 0) -> Sort Sort Key: t1_1.a - -> Seq Scan on prt1_p2 t1_1 + -> Seq Scan on prt1_p1 t1_1 -> Sort Sort Key: t2_1.b - -> Seq Scan on prt2_p2 t2_1 + -> Seq Scan on prt2_p1 t2_1 -> Merge Left Join Merge Cond: (t1_2.a = t2_2.b) -> Sort @@ -1030,14 +1014,30 @@ SELECT t1.a, t1.c, t2.b, t2.c, t3.a + t3.b, t3.c FROM (prt1 t1 LEFT JOIN prt2 t2 Merge Cond: ((((t3_2.a + t3_2.b) / 2)) = t1_2.a) -> Sort Sort Key: (((t3_2.a + t3_2.b) / 2)) - -> Seq Scan on prt1_e_p3 t3_2 + -> Seq Scan on prt1_e_p2 t3_2 Filter: (c = 0) -> Sort Sort Key: t1_2.a - -> Seq Scan on prt1_p3 t1_2 + -> Seq Scan on prt1_p2 t1_2 -> Sort Sort Key: t2_2.b - -> Seq Scan on prt2_p3 t2_2 + -> Seq Scan on prt2_p2 t2_2 + -> Merge Left Join + Merge Cond: (t1_3.a = t2_3.b) + -> Sort + Sort Key: t1_3.a + -> Merge Left Join + Merge Cond: ((((t3_3.a + t3_3.b) / 2)) = t1_3.a) + -> Sort + Sort Key: (((t3_3.a + t3_3.b) / 2)) + -> Seq Scan on prt1_e_p3 t3_3 + Filter: (c = 0) + -> Sort + Sort Key: t1_3.a + -> Seq Scan on prt1_p3 t1_3 + -> Sort + Sort Key: t2_3.b + -> Seq Scan on prt2_p3 t2_3 (51 rows) SELECT t1.a, t1.c, t2.b, t2.c, t3.a + t3.b, t3.c FROM (prt1 t1 LEFT JOIN prt2 t2 ON t1.a = t2.b) RIGHT JOIN prt1_e t3 ON (t1.a = (t3.a + t3.b)/2) WHERE t3.c = 0 ORDER BY t1.a, t2.b, t3.a + t3.b; @@ -1070,16 +1070,16 @@ SELECT t1.a, t2.b FROM (SELECT * FROM prt1 WHERE a < 450) t1 LEFT JOIN (SELECT * -> Sort Sort Key: prt1.a -> Append - -> Seq Scan on prt1_p1 prt1 + -> Seq Scan on prt1_p1 prt1_1 Filter: ((a < 450) AND (b = 0)) - -> Seq Scan on prt1_p2 prt1_1 + -> Seq Scan on prt1_p2 prt1_2 Filter: ((a < 450) AND (b = 0)) -> Sort Sort Key: prt2.b -> Append - -> Seq Scan on prt2_p2 prt2 + -> Seq Scan on prt2_p2 prt2_1 Filter: (b > 250) - -> Seq Scan on prt2_p3 prt2_1 + -> Seq Scan on prt2_p3 prt2_2 Filter: (b > 250) (18 rows) @@ -1109,16 +1109,16 @@ SELECT t1.a, t2.b FROM prt1 t1, prt2 t2 WHERE t1::text = t2::text AND t1.a = t2. Sort Key: t1.a, ((((t1.*)::prt1))::text) -> Result -> Append - -> Seq Scan on prt1_p1 t1 - -> Seq Scan on prt1_p2 t1_1 - -> Seq Scan on prt1_p3 t1_2 + -> Seq Scan on prt1_p1 t1_1 + -> Seq Scan on prt1_p2 t1_2 + -> Seq Scan on prt1_p3 t1_3 -> Sort Sort Key: t2.b, ((((t2.*)::prt2))::text) -> Result -> Append - -> Seq Scan on prt2_p1 t2 - -> Seq Scan on prt2_p2 t2_1 - -> Seq Scan on prt2_p3 t2_2 + -> Seq Scan on prt2_p1 t2_1 + -> Seq Scan on prt2_p2 t2_2 + -> Seq Scan on prt2_p3 t2_3 (16 rows) SELECT t1.a, t2.b FROM prt1 t1, prt2 t2 WHERE t1::text = t2::text AND t1.a = t2.b ORDER BY t1.a; @@ -1155,26 +1155,26 @@ SELECT t1.a, t1.c, t2.b, t2.c FROM (SELECT * FROM prt1_m WHERE prt1_m.c = 0) t1 Sort Sort Key: prt1_m.a, prt2_m.b -> Append - -> Hash Full Join - Hash Cond: ((prt1_m.a = ((prt2_m.b + prt2_m.a) / 2)) AND (((prt1_m.a + prt1_m.b) / 2) = prt2_m.b)) - -> Seq Scan on prt1_m_p1 prt1_m - Filter: (c = 0) - -> Hash - -> Seq Scan on prt2_m_p1 prt2_m - Filter: (c = 0) -> Hash Full Join Hash Cond: ((prt1_m_1.a = ((prt2_m_1.b + prt2_m_1.a) / 2)) AND (((prt1_m_1.a + prt1_m_1.b) / 2) = prt2_m_1.b)) - -> Seq Scan on prt1_m_p2 prt1_m_1 + -> Seq Scan on prt1_m_p1 prt1_m_1 Filter: (c = 0) -> Hash - -> Seq Scan on prt2_m_p2 prt2_m_1 + -> Seq Scan on prt2_m_p1 prt2_m_1 Filter: (c = 0) -> Hash Full Join Hash Cond: ((prt1_m_2.a = ((prt2_m_2.b + prt2_m_2.a) / 2)) AND (((prt1_m_2.a + prt1_m_2.b) / 2) = prt2_m_2.b)) - -> Seq Scan on prt1_m_p3 prt1_m_2 + -> Seq Scan on prt1_m_p2 prt1_m_2 Filter: (c = 0) -> Hash - -> Seq Scan on prt2_m_p3 prt2_m_2 + -> Seq Scan on prt2_m_p2 prt2_m_2 + Filter: (c = 0) + -> Hash Full Join + Hash Cond: ((prt1_m_3.a = ((prt2_m_3.b + prt2_m_3.a) / 2)) AND (((prt1_m_3.a + prt1_m_3.b) / 2) = prt2_m_3.b)) + -> Seq Scan on prt1_m_p3 prt1_m_3 + Filter: (c = 0) + -> Hash + -> Seq Scan on prt2_m_p3 prt2_m_3 Filter: (c = 0) (24 rows) @@ -1233,33 +1233,33 @@ SELECT avg(t1.a), avg(t2.b), avg(t3.a + t3.b), t1.c, t2.c, t3.c FROM plt1 t1, pl -> Sort Sort Key: t1.c, t3.c -> Append - -> Hash Join - Hash Cond: (t1.c = ltrim(t3.c, 'A'::text)) - -> Hash Join - Hash Cond: ((t1.b = t2.b) AND (t1.c = t2.c)) - -> Seq Scan on plt1_p1 t1 - -> Hash - -> Seq Scan on plt2_p1 t2 - -> Hash - -> Seq Scan on plt1_e_p1 t3 -> Hash Join Hash Cond: (t1_1.c = ltrim(t3_1.c, 'A'::text)) -> Hash Join Hash Cond: ((t1_1.b = t2_1.b) AND (t1_1.c = t2_1.c)) - -> Seq Scan on plt1_p2 t1_1 + -> Seq Scan on plt1_p1 t1_1 -> Hash - -> Seq Scan on plt2_p2 t2_1 + -> Seq Scan on plt2_p1 t2_1 -> Hash - -> Seq Scan on plt1_e_p2 t3_1 + -> Seq Scan on plt1_e_p1 t3_1 -> Hash Join Hash Cond: (t1_2.c = ltrim(t3_2.c, 'A'::text)) -> Hash Join Hash Cond: ((t1_2.b = t2_2.b) AND (t1_2.c = t2_2.c)) - -> Seq Scan on plt1_p3 t1_2 + -> Seq Scan on plt1_p2 t1_2 -> Hash - -> Seq Scan on plt2_p3 t2_2 + -> Seq Scan on plt2_p2 t2_2 -> Hash - -> Seq Scan on plt1_e_p3 t3_2 + -> Seq Scan on plt1_e_p2 t3_2 + -> Hash Join + Hash Cond: (t1_3.c = ltrim(t3_3.c, 'A'::text)) + -> Hash Join + Hash Cond: ((t1_3.b = t2_3.b) AND (t1_3.c = t2_3.c)) + -> Seq Scan on plt1_p3 t1_3 + -> Hash + -> Seq Scan on plt2_p3 t2_3 + -> Hash + -> Seq Scan on plt1_e_p3 t3_3 (32 rows) SELECT avg(t1.a), avg(t2.b), avg(t3.a + t3.b), t1.c, t2.c, t3.c FROM plt1 t1, plt2 t2, plt1_e t3 WHERE t1.b = t2.b AND t1.c = t2.c AND ltrim(t3.c, 'A') = t1.c GROUP BY t1.c, t2.c, t3.c ORDER BY t1.c, t2.c, t3.c; @@ -1303,21 +1303,21 @@ SELECT t1.a, t1.c, t2.b, t2.c FROM (SELECT * FROM prt1 WHERE a = 1 AND a = 2) t1 Hash Left Join Hash Cond: (t2.b = a) -> Append - -> Hash Join - Hash Cond: (t3.a = t2.b) - -> Seq Scan on prt1_p1 t3 - -> Hash - -> Seq Scan on prt2_p1 t2 -> Hash Join Hash Cond: (t3_1.a = t2_1.b) - -> Seq Scan on prt1_p2 t3_1 + -> Seq Scan on prt1_p1 t3_1 -> Hash - -> Seq Scan on prt2_p2 t2_1 + -> Seq Scan on prt2_p1 t2_1 -> Hash Join Hash Cond: (t3_2.a = t2_2.b) - -> Seq Scan on prt1_p3 t3_2 + -> Seq Scan on prt1_p2 t3_2 -> Hash - -> Seq Scan on prt2_p3 t2_2 + -> Seq Scan on prt2_p2 t2_2 + -> Hash Join + Hash Cond: (t3_3.a = t2_3.b) + -> Seq Scan on prt1_p3 t3_3 + -> Hash + -> Seq Scan on prt2_p3 t2_3 -> Hash -> Result One-Time Filter: false @@ -1332,11 +1332,11 @@ SELECT t1.a, t1.c, t2.b, t2.c FROM (SELECT * FROM prt1 WHERE a = 1 AND a = 2) t1 -> Hash Left Join Hash Cond: (t2.b = a) -> Append - -> Seq Scan on prt2_p1 t2 + -> Seq Scan on prt2_p1 t2_1 Filter: (a = 0) - -> Seq Scan on prt2_p2 t2_1 + -> Seq Scan on prt2_p2 t2_2 Filter: (a = 0) - -> Seq Scan on prt2_p3 t2_2 + -> Seq Scan on prt2_p3 t2_3 Filter: (a = 0) -> Hash -> Result @@ -1377,33 +1377,33 @@ SELECT avg(t1.a), avg(t2.b), avg(t3.a + t3.b), t1.c, t2.c, t3.c FROM pht1 t1, ph -> Sort Sort Key: t1.c, t3.c -> Append - -> Hash Join - Hash Cond: (t1.c = ltrim(t3.c, 'A'::text)) - -> Hash Join - Hash Cond: ((t1.b = t2.b) AND (t1.c = t2.c)) - -> Seq Scan on pht1_p1 t1 - -> Hash - -> Seq Scan on pht2_p1 t2 - -> Hash - -> Seq Scan on pht1_e_p1 t3 -> Hash Join Hash Cond: (t1_1.c = ltrim(t3_1.c, 'A'::text)) -> Hash Join Hash Cond: ((t1_1.b = t2_1.b) AND (t1_1.c = t2_1.c)) - -> Seq Scan on pht1_p2 t1_1 + -> Seq Scan on pht1_p1 t1_1 -> Hash - -> Seq Scan on pht2_p2 t2_1 + -> Seq Scan on pht2_p1 t2_1 -> Hash - -> Seq Scan on pht1_e_p2 t3_1 + -> Seq Scan on pht1_e_p1 t3_1 -> Hash Join Hash Cond: (t1_2.c = ltrim(t3_2.c, 'A'::text)) -> Hash Join Hash Cond: ((t1_2.b = t2_2.b) AND (t1_2.c = t2_2.c)) - -> Seq Scan on pht1_p3 t1_2 + -> Seq Scan on pht1_p2 t1_2 -> Hash - -> Seq Scan on pht2_p3 t2_2 + -> Seq Scan on pht2_p2 t2_2 -> Hash - -> Seq Scan on pht1_e_p3 t3_2 + -> Seq Scan on pht1_e_p2 t3_2 + -> Hash Join + Hash Cond: (t1_3.c = ltrim(t3_3.c, 'A'::text)) + -> Hash Join + Hash Cond: ((t1_3.b = t2_3.b) AND (t1_3.c = t2_3.c)) + -> Seq Scan on pht1_p3 t1_3 + -> Hash + -> Seq Scan on pht2_p3 t2_3 + -> Hash + -> Seq Scan on pht1_e_p3 t3_3 (32 rows) SELECT avg(t1.a), avg(t2.b), avg(t3.a + t3.b), t1.c, t2.c, t3.c FROM pht1 t1, pht2 t2, pht1_e t3 WHERE t1.b = t2.b AND t1.c = t2.c AND ltrim(t3.c, 'A') = t1.c GROUP BY t1.c, t2.c, t3.c ORDER BY t1.c, t2.c, t3.c; @@ -1431,23 +1431,23 @@ SELECT t1.a, t1.c, t2.b, t2.c FROM prt1 t1, prt2 t2 WHERE t1.a = t2.b AND t1.b = Sort Sort Key: t1.a -> Append - -> Hash Join - Hash Cond: (t2.b = t1.a) - -> Seq Scan on prt2_p1 t2 - -> Hash - -> Seq Scan on prt1_p1 t1 - Filter: (b = 0) -> Hash Join Hash Cond: (t2_1.b = t1_1.a) - -> Seq Scan on prt2_p2 t2_1 + -> Seq Scan on prt2_p1 t2_1 -> Hash - -> Seq Scan on prt1_p2 t1_1 + -> Seq Scan on prt1_p1 t1_1 Filter: (b = 0) -> Hash Join Hash Cond: (t2_2.b = t1_2.a) - -> Seq Scan on prt2_p3 t2_2 + -> Seq Scan on prt2_p2 t2_2 -> Hash - -> Seq Scan on prt1_p3 t1_2 + -> Seq Scan on prt1_p2 t1_2 + Filter: (b = 0) + -> Hash Join + Hash Cond: (t2_3.b = t1_3.a) + -> Seq Scan on prt2_p3 t2_3 + -> Hash + -> Seq Scan on prt1_p3 t1_3 Filter: (b = 0) (21 rows) @@ -1467,23 +1467,23 @@ SELECT avg(t1.a), avg(t2.b), t1.c, t2.c FROM plt1 t1 RIGHT JOIN plt2 t2 ON t1.c -> HashAggregate Group Key: t1.c, t2.c -> Append - -> Hash Join - Hash Cond: (t2.c = t1.c) - -> Seq Scan on plt2_p1 t2 - -> Hash - -> Seq Scan on plt1_p1 t1 - Filter: ((a % 25) = 0) -> Hash Join Hash Cond: (t2_1.c = t1_1.c) - -> Seq Scan on plt2_p2 t2_1 + -> Seq Scan on plt2_p1 t2_1 -> Hash - -> Seq Scan on plt1_p2 t1_1 + -> Seq Scan on plt1_p1 t1_1 Filter: ((a % 25) = 0) -> Hash Join Hash Cond: (t2_2.c = t1_2.c) - -> Seq Scan on plt2_p3 t2_2 + -> Seq Scan on plt2_p2 t2_2 -> Hash - -> Seq Scan on plt1_p3 t1_2 + -> Seq Scan on plt1_p2 t1_2 + Filter: ((a % 25) = 0) + -> Hash Join + Hash Cond: (t2_3.c = t1_3.c) + -> Seq Scan on plt2_p3 t2_3 + -> Hash + -> Seq Scan on plt1_p3 t1_3 Filter: ((a % 25) = 0) (23 rows) @@ -1518,30 +1518,30 @@ SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_l t1, prt2_l t2 WHERE t1.a = t2.b AND t1 Sort Sort Key: t1.a -> Append - -> Hash Join - Hash Cond: (t2.b = t1.a) - -> Seq Scan on prt2_l_p1 t2 - -> Hash - -> Seq Scan on prt1_l_p1 t1 - Filter: (b = 0) -> Hash Join Hash Cond: (t2_1.b = t1_1.a) - -> Append - -> Seq Scan on prt2_l_p2_p1 t2_1 - -> Seq Scan on prt2_l_p2_p2 t2_2 + -> Seq Scan on prt2_l_p1 t2_1 -> Hash - -> Append - -> Seq Scan on prt1_l_p2_p1 t1_1 - Filter: (b = 0) - -> Seq Scan on prt1_l_p2_p2 t1_2 - Filter: (b = 0) + -> Seq Scan on prt1_l_p1 t1_1 + Filter: (b = 0) -> Hash Join Hash Cond: (t2_3.b = t1_3.a) -> Append - -> Seq Scan on prt2_l_p3_p1 t2_3 - -> Seq Scan on prt2_l_p3_p2 t2_4 + -> Seq Scan on prt2_l_p2_p1 t2_3 + -> Seq Scan on prt2_l_p2_p2 t2_4 -> Hash - -> Seq Scan on prt1_l_p3_p1 t1_3 + -> Append + -> Seq Scan on prt1_l_p2_p1 t1_3 + Filter: (b = 0) + -> Seq Scan on prt1_l_p2_p2 t1_4 + Filter: (b = 0) + -> Hash Join + Hash Cond: (t2_6.b = t1_5.a) + -> Append + -> Seq Scan on prt2_l_p3_p1 t2_6 + -> Seq Scan on prt2_l_p3_p2 t2_7 + -> Hash + -> Seq Scan on prt1_l_p3_p1 t1_5 Filter: (b = 0) (28 rows) @@ -1562,31 +1562,31 @@ SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_l t1 LEFT JOIN prt2_l t2 ON t1.a = t2.b Sort Sort Key: t1.a, t2.b -> Append - -> Hash Right Join - Hash Cond: ((t2.b = t1.a) AND ((t2.c)::text = (t1.c)::text)) - -> Seq Scan on prt2_l_p1 t2 - -> Hash - -> Seq Scan on prt1_l_p1 t1 - Filter: (b = 0) -> Hash Right Join Hash Cond: ((t2_1.b = t1_1.a) AND ((t2_1.c)::text = (t1_1.c)::text)) - -> Seq Scan on prt2_l_p2_p1 t2_1 + -> Seq Scan on prt2_l_p1 t2_1 -> Hash - -> Seq Scan on prt1_l_p2_p1 t1_1 + -> Seq Scan on prt1_l_p1 t1_1 Filter: (b = 0) -> Hash Right Join Hash Cond: ((t2_2.b = t1_2.a) AND ((t2_2.c)::text = (t1_2.c)::text)) - -> Seq Scan on prt2_l_p2_p2 t2_2 + -> Seq Scan on prt2_l_p2_p1 t2_2 -> Hash - -> Seq Scan on prt1_l_p2_p2 t1_2 + -> Seq Scan on prt1_l_p2_p1 t1_2 Filter: (b = 0) -> Hash Right Join Hash Cond: ((t2_3.b = t1_3.a) AND ((t2_3.c)::text = (t1_3.c)::text)) - -> Append - -> Seq Scan on prt2_l_p3_p1 t2_3 - -> Seq Scan on prt2_l_p3_p2 t2_4 + -> Seq Scan on prt2_l_p2_p2 t2_3 -> Hash - -> Seq Scan on prt1_l_p3_p1 t1_3 + -> Seq Scan on prt1_l_p2_p2 t1_3 + Filter: (b = 0) + -> Hash Right Join + Hash Cond: ((t2_5.b = t1_4.a) AND ((t2_5.c)::text = (t1_4.c)::text)) + -> Append + -> Seq Scan on prt2_l_p3_p1 t2_5 + -> Seq Scan on prt2_l_p3_p2 t2_6 + -> Hash + -> Seq Scan on prt1_l_p3_p1 t1_4 Filter: (b = 0) (29 rows) @@ -1615,31 +1615,31 @@ SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_l t1 RIGHT JOIN prt2_l t2 ON t1.a = t2.b Sort Sort Key: t1.a, t2.b -> Append - -> Hash Right Join - Hash Cond: ((t1.a = t2.b) AND ((t1.c)::text = (t2.c)::text)) - -> Seq Scan on prt1_l_p1 t1 - -> Hash - -> Seq Scan on prt2_l_p1 t2 - Filter: (a = 0) -> Hash Right Join Hash Cond: ((t1_1.a = t2_1.b) AND ((t1_1.c)::text = (t2_1.c)::text)) - -> Seq Scan on prt1_l_p2_p1 t1_1 + -> Seq Scan on prt1_l_p1 t1_1 -> Hash - -> Seq Scan on prt2_l_p2_p1 t2_1 + -> Seq Scan on prt2_l_p1 t2_1 Filter: (a = 0) -> Hash Right Join Hash Cond: ((t1_2.a = t2_2.b) AND ((t1_2.c)::text = (t2_2.c)::text)) - -> Seq Scan on prt1_l_p2_p2 t1_2 + -> Seq Scan on prt1_l_p2_p1 t1_2 -> Hash - -> Seq Scan on prt2_l_p2_p2 t2_2 + -> Seq Scan on prt2_l_p2_p1 t2_2 Filter: (a = 0) -> Hash Right Join Hash Cond: ((t1_3.a = t2_3.b) AND ((t1_3.c)::text = (t2_3.c)::text)) - -> Append - -> Seq Scan on prt1_l_p3_p1 t1_3 - -> Seq Scan on prt1_l_p3_p2 t1_4 + -> Seq Scan on prt1_l_p2_p2 t1_3 -> Hash - -> Seq Scan on prt2_l_p3_p1 t2_3 + -> Seq Scan on prt2_l_p2_p2 t2_3 + Filter: (a = 0) + -> Hash Right Join + Hash Cond: ((t1_5.a = t2_4.b) AND ((t1_5.c)::text = (t2_4.c)::text)) + -> Append + -> Seq Scan on prt1_l_p3_p1 t1_5 + -> Seq Scan on prt1_l_p3_p2 t1_6 + -> Hash + -> Seq Scan on prt2_l_p3_p1 t2_4 Filter: (a = 0) (29 rows) @@ -1664,33 +1664,33 @@ SELECT t1.a, t1.c, t2.b, t2.c FROM (SELECT * FROM prt1_l WHERE prt1_l.b = 0) t1 Sort Sort Key: prt1_l.a, prt2_l.b -> Append - -> Hash Full Join - Hash Cond: ((prt1_l.a = prt2_l.b) AND ((prt1_l.c)::text = (prt2_l.c)::text)) - -> Seq Scan on prt1_l_p1 prt1_l - Filter: (b = 0) - -> Hash - -> Seq Scan on prt2_l_p1 prt2_l - Filter: (a = 0) -> Hash Full Join Hash Cond: ((prt1_l_1.a = prt2_l_1.b) AND ((prt1_l_1.c)::text = (prt2_l_1.c)::text)) - -> Seq Scan on prt1_l_p2_p1 prt1_l_1 + -> Seq Scan on prt1_l_p1 prt1_l_1 Filter: (b = 0) -> Hash - -> Seq Scan on prt2_l_p2_p1 prt2_l_1 + -> Seq Scan on prt2_l_p1 prt2_l_1 Filter: (a = 0) -> Hash Full Join Hash Cond: ((prt1_l_2.a = prt2_l_2.b) AND ((prt1_l_2.c)::text = (prt2_l_2.c)::text)) - -> Seq Scan on prt1_l_p2_p2 prt1_l_2 + -> Seq Scan on prt1_l_p2_p1 prt1_l_2 Filter: (b = 0) -> Hash - -> Seq Scan on prt2_l_p2_p2 prt2_l_2 + -> Seq Scan on prt2_l_p2_p1 prt2_l_2 Filter: (a = 0) -> Hash Full Join Hash Cond: ((prt1_l_3.a = prt2_l_3.b) AND ((prt1_l_3.c)::text = (prt2_l_3.c)::text)) - -> Seq Scan on prt1_l_p3_p1 prt1_l_3 + -> Seq Scan on prt1_l_p2_p2 prt1_l_3 Filter: (b = 0) -> Hash - -> Seq Scan on prt2_l_p3_p1 prt2_l_3 + -> Seq Scan on prt2_l_p2_p2 prt2_l_3 + Filter: (a = 0) + -> Hash Full Join + Hash Cond: ((prt1_l_4.a = prt2_l_4.b) AND ((prt1_l_4.c)::text = (prt2_l_4.c)::text)) + -> Seq Scan on prt1_l_p3_p1 prt1_l_4 + Filter: (b = 0) + -> Hash + -> Seq Scan on prt2_l_p3_p1 prt2_l_4 Filter: (a = 0) (31 rows) @@ -1726,46 +1726,46 @@ SELECT * FROM prt1_l t1 LEFT JOIN LATERAL Sort Key: t1.a -> Append -> Nested Loop Left Join - -> Seq Scan on prt1_l_p1 t1 - Filter: (b = 0) - -> Hash Join - Hash Cond: ((t3.b = t2.a) AND ((t3.c)::text = (t2.c)::text)) - -> Seq Scan on prt2_l_p1 t3 - -> Hash - -> Seq Scan on prt1_l_p1 t2 - Filter: ((t1.a = a) AND ((t1.c)::text = (c)::text)) - -> Nested Loop Left Join - -> Seq Scan on prt1_l_p2_p1 t1_1 + -> Seq Scan on prt1_l_p1 t1_1 Filter: (b = 0) -> Hash Join Hash Cond: ((t3_1.b = t2_1.a) AND ((t3_1.c)::text = (t2_1.c)::text)) - -> Seq Scan on prt2_l_p2_p1 t3_1 + -> Seq Scan on prt2_l_p1 t3_1 -> Hash - -> Seq Scan on prt1_l_p2_p1 t2_1 + -> Seq Scan on prt1_l_p1 t2_1 Filter: ((t1_1.a = a) AND ((t1_1.c)::text = (c)::text)) -> Nested Loop Left Join - -> Seq Scan on prt1_l_p2_p2 t1_2 + -> Seq Scan on prt1_l_p2_p1 t1_2 Filter: (b = 0) -> Hash Join Hash Cond: ((t3_2.b = t2_2.a) AND ((t3_2.c)::text = (t2_2.c)::text)) - -> Seq Scan on prt2_l_p2_p2 t3_2 + -> Seq Scan on prt2_l_p2_p1 t3_2 -> Hash - -> Seq Scan on prt1_l_p2_p2 t2_2 + -> Seq Scan on prt1_l_p2_p1 t2_2 Filter: ((t1_2.a = a) AND ((t1_2.c)::text = (c)::text)) -> Nested Loop Left Join - -> Seq Scan on prt1_l_p3_p1 t1_3 + -> Seq Scan on prt1_l_p2_p2 t1_3 Filter: (b = 0) -> Hash Join Hash Cond: ((t3_3.b = t2_3.a) AND ((t3_3.c)::text = (t2_3.c)::text)) + -> Seq Scan on prt2_l_p2_p2 t3_3 + -> Hash + -> Seq Scan on prt1_l_p2_p2 t2_3 + Filter: ((t1_3.a = a) AND ((t1_3.c)::text = (c)::text)) + -> Nested Loop Left Join + -> Seq Scan on prt1_l_p3_p1 t1_4 + Filter: (b = 0) + -> Hash Join + Hash Cond: ((t3_5.b = t2_5.a) AND ((t3_5.c)::text = (t2_5.c)::text)) -> Append - -> Seq Scan on prt2_l_p3_p1 t3_3 - -> Seq Scan on prt2_l_p3_p2 t3_4 + -> Seq Scan on prt2_l_p3_p1 t3_5 + -> Seq Scan on prt2_l_p3_p2 t3_6 -> Hash -> Append - -> Seq Scan on prt1_l_p3_p1 t2_3 - Filter: ((t1_3.a = a) AND ((t1_3.c)::text = (c)::text)) - -> Seq Scan on prt1_l_p3_p2 t2_4 - Filter: ((t1_3.a = a) AND ((t1_3.c)::text = (c)::text)) + -> Seq Scan on prt1_l_p3_p1 t2_5 + Filter: ((t1_4.a = a) AND ((t1_4.c)::text = (c)::text)) + -> Seq Scan on prt1_l_p3_p2 t2_6 + Filter: ((t1_4.a = a) AND ((t1_4.c)::text = (c)::text)) (44 rows) SELECT * FROM prt1_l t1 LEFT JOIN LATERAL @@ -1795,11 +1795,11 @@ SELECT t1.a, t1.c, t2.b, t2.c FROM (SELECT * FROM prt1_l WHERE a = 1 AND a = 2) Hash Left Join Hash Cond: ((t2.b = a) AND (t2.a = b) AND ((t2.c)::text = (c)::text)) -> Append - -> Seq Scan on prt2_l_p1 t2 - -> Seq Scan on prt2_l_p2_p1 t2_1 - -> Seq Scan on prt2_l_p2_p2 t2_2 - -> Seq Scan on prt2_l_p3_p1 t2_3 - -> Seq Scan on prt2_l_p3_p2 t2_4 + -> Seq Scan on prt2_l_p1 t2_1 + -> Seq Scan on prt2_l_p2_p1 t2_2 + -> Seq Scan on prt2_l_p2_p2 t2_3 + -> Seq Scan on prt2_l_p3_p1 t2_4 + -> Seq Scan on prt2_l_p3_p2 t2_5 -> Hash -> Result One-Time Filter: false @@ -1881,14 +1881,14 @@ SELECT t1.a, t1.c, t2.b, t2.c FROM prt1 t1, prt4_n t2 WHERE t1.a = t2.a; Hash Join Hash Cond: (t1.a = t2.a) -> Append - -> Seq Scan on prt1_p1 t1 - -> Seq Scan on prt1_p2 t1_1 - -> Seq Scan on prt1_p3 t1_2 + -> Seq Scan on prt1_p1 t1_1 + -> Seq Scan on prt1_p2 t1_2 + -> Seq Scan on prt1_p3 t1_3 -> Hash -> Append - -> Seq Scan on prt4_n_p1 t2 - -> Seq Scan on prt4_n_p2 t2_1 - -> Seq Scan on prt4_n_p3 t2_2 + -> Seq Scan on prt4_n_p1 t2_1 + -> Seq Scan on prt4_n_p2 t2_2 + -> Seq Scan on prt4_n_p3 t2_3 (11 rows) EXPLAIN (COSTS OFF) @@ -1898,26 +1898,26 @@ SELECT t1.a, t1.c, t2.b, t2.c FROM prt1 t1, prt4_n t2, prt2 t3 WHERE t1.a = t2.a Hash Join Hash Cond: (t2.a = t1.a) -> Append - -> Seq Scan on prt4_n_p1 t2 - -> Seq Scan on prt4_n_p2 t2_1 - -> Seq Scan on prt4_n_p3 t2_2 + -> Seq Scan on prt4_n_p1 t2_1 + -> Seq Scan on prt4_n_p2 t2_2 + -> Seq Scan on prt4_n_p3 t2_3 -> Hash -> Append - -> Hash Join - Hash Cond: (t1.a = t3.b) - -> Seq Scan on prt1_p1 t1 - -> Hash - -> Seq Scan on prt2_p1 t3 -> Hash Join Hash Cond: (t1_1.a = t3_1.b) - -> Seq Scan on prt1_p2 t1_1 + -> Seq Scan on prt1_p1 t1_1 -> Hash - -> Seq Scan on prt2_p2 t3_1 + -> Seq Scan on prt2_p1 t3_1 -> Hash Join Hash Cond: (t1_2.a = t3_2.b) - -> Seq Scan on prt1_p3 t1_2 + -> Seq Scan on prt1_p2 t1_2 -> Hash - -> Seq Scan on prt2_p3 t3_2 + -> Seq Scan on prt2_p2 t3_2 + -> Hash Join + Hash Cond: (t1_3.a = t3_3.b) + -> Seq Scan on prt1_p3 t1_3 + -> Hash + -> Seq Scan on prt2_p3 t3_3 (23 rows) -- partitionwise join can not be applied if there are no equi-join conditions @@ -1928,15 +1928,15 @@ SELECT t1.a, t1.c, t2.b, t2.c FROM prt1 t1 LEFT JOIN prt2 t2 ON (t1.a < t2.b); --------------------------------------------------------- Nested Loop Left Join -> Append - -> Seq Scan on prt1_p1 t1 - -> Seq Scan on prt1_p2 t1_1 - -> Seq Scan on prt1_p3 t1_2 + -> Seq Scan on prt1_p1 t1_1 + -> Seq Scan on prt1_p2 t1_2 + -> Seq Scan on prt1_p3 t1_3 -> Append - -> Index Scan using iprt2_p1_b on prt2_p1 t2 + -> Index Scan using iprt2_p1_b on prt2_p1 t2_1 Index Cond: (b > t1.a) - -> Index Scan using iprt2_p2_b on prt2_p2 t2_1 + -> Index Scan using iprt2_p2_b on prt2_p2 t2_2 Index Cond: (b > t1.a) - -> Index Scan using iprt2_p3_b on prt2_p3 t2_2 + -> Index Scan using iprt2_p3_b on prt2_p3 t2_3 Index Cond: (b > t1.a) (12 rows) @@ -1949,14 +1949,14 @@ SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_m t1, prt2_m t2 WHERE t1.a = (t2.b + t2. Hash Join Hash Cond: (((t2.b + t2.a) / 2) = t1.a) -> Append - -> Seq Scan on prt2_m_p1 t2 - -> Seq Scan on prt2_m_p2 t2_1 - -> Seq Scan on prt2_m_p3 t2_2 + -> Seq Scan on prt2_m_p1 t2_1 + -> Seq Scan on prt2_m_p2 t2_2 + -> Seq Scan on prt2_m_p3 t2_3 -> Hash -> Append - -> Seq Scan on prt1_m_p1 t1 - -> Seq Scan on prt1_m_p2 t1_1 - -> Seq Scan on prt1_m_p3 t1_2 + -> Seq Scan on prt1_m_p1 t1_1 + -> Seq Scan on prt1_m_p2 t1_2 + -> Seq Scan on prt1_m_p3 t1_3 (11 rows) -- equi-join between out-of-order partition key columns does not qualify for @@ -1968,14 +1968,14 @@ SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_m t1 LEFT JOIN prt2_m t2 ON t1.a = t2.b; Hash Left Join Hash Cond: (t1.a = t2.b) -> Append - -> Seq Scan on prt1_m_p1 t1 - -> Seq Scan on prt1_m_p2 t1_1 - -> Seq Scan on prt1_m_p3 t1_2 + -> Seq Scan on prt1_m_p1 t1_1 + -> Seq Scan on prt1_m_p2 t1_2 + -> Seq Scan on prt1_m_p3 t1_3 -> Hash -> Append - -> Seq Scan on prt2_m_p1 t2 - -> Seq Scan on prt2_m_p2 t2_1 - -> Seq Scan on prt2_m_p3 t2_2 + -> Seq Scan on prt2_m_p1 t2_1 + -> Seq Scan on prt2_m_p2 t2_2 + -> Seq Scan on prt2_m_p3 t2_3 (11 rows) -- equi-join between non-key columns does not qualify for partitionwise join @@ -1986,14 +1986,14 @@ SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_m t1 LEFT JOIN prt2_m t2 ON t1.c = t2.c; Hash Left Join Hash Cond: (t1.c = t2.c) -> Append - -> Seq Scan on prt1_m_p1 t1 - -> Seq Scan on prt1_m_p2 t1_1 - -> Seq Scan on prt1_m_p3 t1_2 + -> Seq Scan on prt1_m_p1 t1_1 + -> Seq Scan on prt1_m_p2 t1_2 + -> Seq Scan on prt1_m_p3 t1_3 -> Hash -> Append - -> Seq Scan on prt2_m_p1 t2 - -> Seq Scan on prt2_m_p2 t2_1 - -> Seq Scan on prt2_m_p3 t2_2 + -> Seq Scan on prt2_m_p1 t2_1 + -> Seq Scan on prt2_m_p2 t2_2 + -> Seq Scan on prt2_m_p3 t2_3 (11 rows) -- partitionwise join can not be applied between tables with different @@ -2005,12 +2005,12 @@ SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_n t1 LEFT JOIN prt2_n t2 ON (t1.c = t2.c Hash Right Join Hash Cond: (t2.c = (t1.c)::text) -> Append - -> Seq Scan on prt2_n_p1 t2 - -> Seq Scan on prt2_n_p2 t2_1 + -> Seq Scan on prt2_n_p1 t2_1 + -> Seq Scan on prt2_n_p2 t2_2 -> Hash -> Append - -> Seq Scan on prt1_n_p1 t1 - -> Seq Scan on prt1_n_p2 t1_1 + -> Seq Scan on prt1_n_p1 t1_1 + -> Seq Scan on prt1_n_p2 t1_2 (9 rows) EXPLAIN (COSTS OFF) @@ -2020,19 +2020,19 @@ SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_n t1 JOIN prt2_n t2 ON (t1.c = t2.c) JOI Hash Join Hash Cond: (t2.c = (t1.c)::text) -> Append - -> Seq Scan on prt2_n_p1 t2 - -> Seq Scan on prt2_n_p2 t2_1 + -> Seq Scan on prt2_n_p1 t2_1 + -> Seq Scan on prt2_n_p2 t2_2 -> Hash -> Hash Join Hash Cond: (t3.c = (t1.c)::text) -> Append - -> Seq Scan on plt1_p1 t3 - -> Seq Scan on plt1_p2 t3_1 - -> Seq Scan on plt1_p3 t3_2 + -> Seq Scan on plt1_p1 t3_1 + -> Seq Scan on plt1_p2 t3_2 + -> Seq Scan on plt1_p3 t3_3 -> Hash -> Append - -> Seq Scan on prt1_n_p1 t1 - -> Seq Scan on prt1_n_p2 t1_1 + -> Seq Scan on prt1_n_p1 t1_1 + -> Seq Scan on prt1_n_p2 t1_2 (16 rows) -- partitionwise join can not be applied for a join between list and range @@ -2044,13 +2044,13 @@ SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_n t1 FULL JOIN prt1 t2 ON (t1.c = t2.c); Hash Full Join Hash Cond: ((t2.c)::text = (t1.c)::text) -> Append - -> Seq Scan on prt1_p1 t2 - -> Seq Scan on prt1_p2 t2_1 - -> Seq Scan on prt1_p3 t2_2 + -> Seq Scan on prt1_p1 t2_1 + -> Seq Scan on prt1_p2 t2_2 + -> Seq Scan on prt1_p3 t2_3 -> Hash -> Append - -> Seq Scan on prt1_n_p1 t1 - -> Seq Scan on prt1_n_p2 t1_1 + -> Seq Scan on prt1_n_p1 t1_1 + -> Seq Scan on prt1_n_p2 t1_2 (10 rows) -- partitionwise join can not be applied if only one of joining tables has @@ -2067,16 +2067,16 @@ SELECT t1.a, t1.c, t2.b, t2.c FROM prt1 t1, prt2 t2 WHERE t1.a = t2.b AND t1.b = -> Hash Join Hash Cond: (t2.b = t1.a) -> Append - -> Seq Scan on prt2_p1 t2 - -> Seq Scan on prt2_p2 t2_1 - -> Seq Scan on prt2_p3 t2_2 + -> Seq Scan on prt2_p1 t2_1 + -> Seq Scan on prt2_p2 t2_2 + -> Seq Scan on prt2_p3 t2_3 -> Hash -> Append - -> Seq Scan on prt1_p1 t1 + -> Seq Scan on prt1_p1 t1_1 Filter: (b = 0) - -> Seq Scan on prt1_p2 t1_1 + -> Seq Scan on prt1_p2 t1_2 Filter: (b = 0) - -> Seq Scan on prt1_p3 t1_2 + -> Seq Scan on prt1_p3 t1_3 Filter: (b = 0) (16 rows) diff --git a/src/test/regress/expected/partition_prune.out b/src/test/regress/expected/partition_prune.out index f9eeda60e6..57680f1d29 100644 --- a/src/test/regress/expected/partition_prune.out +++ b/src/test/regress/expected/partition_prune.out @@ -14,21 +14,21 @@ explain (costs off) select * from lp; QUERY PLAN ----------------------------------- Append - -> Seq Scan on lp_ad lp - -> Seq Scan on lp_bc lp_1 - -> Seq Scan on lp_ef lp_2 - -> Seq Scan on lp_g lp_3 - -> Seq Scan on lp_null lp_4 - -> Seq Scan on lp_default lp_5 + -> Seq Scan on lp_ad lp_1 + -> Seq Scan on lp_bc lp_2 + -> Seq Scan on lp_ef lp_3 + -> Seq Scan on lp_g lp_4 + -> Seq Scan on lp_null lp_5 + -> Seq Scan on lp_default lp_6 (7 rows) explain (costs off) select * from lp where a > 'a' and a < 'd'; QUERY PLAN ----------------------------------------------------------- Append - -> Seq Scan on lp_bc lp + -> Seq Scan on lp_bc lp_1 Filter: ((a > 'a'::bpchar) AND (a < 'd'::bpchar)) - -> Seq Scan on lp_default lp_1 + -> Seq Scan on lp_default lp_2 Filter: ((a > 'a'::bpchar) AND (a < 'd'::bpchar)) (5 rows) @@ -36,11 +36,11 @@ explain (costs off) select * from lp where a > 'a' and a <= 'd'; QUERY PLAN ------------------------------------------------------------ Append - -> Seq Scan on lp_ad lp + -> Seq Scan on lp_ad lp_1 Filter: ((a > 'a'::bpchar) AND (a <= 'd'::bpchar)) - -> Seq Scan on lp_bc lp_1 + -> Seq Scan on lp_bc lp_2 Filter: ((a > 'a'::bpchar) AND (a <= 'd'::bpchar)) - -> Seq Scan on lp_default lp_2 + -> Seq Scan on lp_default lp_3 Filter: ((a > 'a'::bpchar) AND (a <= 'd'::bpchar)) (7 rows) @@ -62,15 +62,15 @@ explain (costs off) select * from lp where a is not null; QUERY PLAN ----------------------------------- Append - -> Seq Scan on lp_ad lp + -> Seq Scan on lp_ad lp_1 Filter: (a IS NOT NULL) - -> Seq Scan on lp_bc lp_1 + -> Seq Scan on lp_bc lp_2 Filter: (a IS NOT NULL) - -> Seq Scan on lp_ef lp_2 + -> Seq Scan on lp_ef lp_3 Filter: (a IS NOT NULL) - -> Seq Scan on lp_g lp_3 + -> Seq Scan on lp_g lp_4 Filter: (a IS NOT NULL) - -> Seq Scan on lp_default lp_4 + -> Seq Scan on lp_default lp_5 Filter: (a IS NOT NULL) (11 rows) @@ -85,9 +85,9 @@ explain (costs off) select * from lp where a = 'a' or a = 'c'; QUERY PLAN ---------------------------------------------------------- Append - -> Seq Scan on lp_ad lp + -> Seq Scan on lp_ad lp_1 Filter: ((a = 'a'::bpchar) OR (a = 'c'::bpchar)) - -> Seq Scan on lp_bc lp_1 + -> Seq Scan on lp_bc lp_2 Filter: ((a = 'a'::bpchar) OR (a = 'c'::bpchar)) (5 rows) @@ -95,9 +95,9 @@ explain (costs off) select * from lp where a is not null and (a = 'a' or a = 'c' QUERY PLAN -------------------------------------------------------------------------------- Append - -> Seq Scan on lp_ad lp + -> Seq Scan on lp_ad lp_1 Filter: ((a IS NOT NULL) AND ((a = 'a'::bpchar) OR (a = 'c'::bpchar))) - -> Seq Scan on lp_bc lp_1 + -> Seq Scan on lp_bc lp_2 Filter: ((a IS NOT NULL) AND ((a = 'a'::bpchar) OR (a = 'c'::bpchar))) (5 rows) @@ -105,13 +105,13 @@ explain (costs off) select * from lp where a <> 'g'; QUERY PLAN ------------------------------------ Append - -> Seq Scan on lp_ad lp + -> Seq Scan on lp_ad lp_1 Filter: (a <> 'g'::bpchar) - -> Seq Scan on lp_bc lp_1 + -> Seq Scan on lp_bc lp_2 Filter: (a <> 'g'::bpchar) - -> Seq Scan on lp_ef lp_2 + -> Seq Scan on lp_ef lp_3 Filter: (a <> 'g'::bpchar) - -> Seq Scan on lp_default lp_3 + -> Seq Scan on lp_default lp_4 Filter: (a <> 'g'::bpchar) (9 rows) @@ -119,13 +119,13 @@ explain (costs off) select * from lp where a <> 'a' and a <> 'd'; QUERY PLAN ------------------------------------------------------------- Append - -> Seq Scan on lp_bc lp + -> Seq Scan on lp_bc lp_1 Filter: ((a <> 'a'::bpchar) AND (a <> 'd'::bpchar)) - -> Seq Scan on lp_ef lp_1 + -> Seq Scan on lp_ef lp_2 Filter: ((a <> 'a'::bpchar) AND (a <> 'd'::bpchar)) - -> Seq Scan on lp_g lp_2 + -> Seq Scan on lp_g lp_3 Filter: ((a <> 'a'::bpchar) AND (a <> 'd'::bpchar)) - -> Seq Scan on lp_default lp_3 + -> Seq Scan on lp_default lp_4 Filter: ((a <> 'a'::bpchar) AND (a <> 'd'::bpchar)) (9 rows) @@ -133,13 +133,13 @@ explain (costs off) select * from lp where a not in ('a', 'd'); QUERY PLAN ------------------------------------------------ Append - -> Seq Scan on lp_bc lp + -> Seq Scan on lp_bc lp_1 Filter: (a <> ALL ('{a,d}'::bpchar[])) - -> Seq Scan on lp_ef lp_1 + -> Seq Scan on lp_ef lp_2 Filter: (a <> ALL ('{a,d}'::bpchar[])) - -> Seq Scan on lp_g lp_2 + -> Seq Scan on lp_g lp_3 Filter: (a <> ALL ('{a,d}'::bpchar[])) - -> Seq Scan on lp_default lp_3 + -> Seq Scan on lp_default lp_4 Filter: (a <> ALL ('{a,d}'::bpchar[])) (9 rows) @@ -160,11 +160,11 @@ explain (costs off) select * from coll_pruning where a collate "POSIX" = 'a' col QUERY PLAN --------------------------------------------------------- Append - -> Seq Scan on coll_pruning_a coll_pruning + -> Seq Scan on coll_pruning_a coll_pruning_1 Filter: ((a)::text = 'a'::text COLLATE "POSIX") - -> Seq Scan on coll_pruning_b coll_pruning_1 + -> Seq Scan on coll_pruning_b coll_pruning_2 Filter: ((a)::text = 'a'::text COLLATE "POSIX") - -> Seq Scan on coll_pruning_def coll_pruning_2 + -> Seq Scan on coll_pruning_def coll_pruning_3 Filter: ((a)::text = 'a'::text COLLATE "POSIX") (7 rows) @@ -207,9 +207,9 @@ explain (costs off) select * from rlp where a <= 1; QUERY PLAN ------------------------------ Append - -> Seq Scan on rlp1 rlp + -> Seq Scan on rlp1 rlp_1 Filter: (a <= 1) - -> Seq Scan on rlp2 rlp_1 + -> Seq Scan on rlp2 rlp_2 Filter: (a <= 1) (5 rows) @@ -231,35 +231,35 @@ explain (costs off) select * from rlp where a = 1::numeric; /* no pruning */ QUERY PLAN ----------------------------------------------- Append - -> Seq Scan on rlp1 rlp + -> Seq Scan on rlp1 rlp_1 Filter: ((a)::numeric = '1'::numeric) - -> Seq Scan on rlp2 rlp_1 + -> Seq Scan on rlp2 rlp_2 Filter: ((a)::numeric = '1'::numeric) - -> Seq Scan on rlp3abcd rlp_2 + -> Seq Scan on rlp3abcd rlp_3 Filter: ((a)::numeric = '1'::numeric) - -> Seq Scan on rlp3efgh rlp_3 + -> Seq Scan on rlp3efgh rlp_4 Filter: ((a)::numeric = '1'::numeric) - -> Seq Scan on rlp3nullxy rlp_4 + -> Seq Scan on rlp3nullxy rlp_5 Filter: ((a)::numeric = '1'::numeric) - -> Seq Scan on rlp3_default rlp_5 + -> Seq Scan on rlp3_default rlp_6 Filter: ((a)::numeric = '1'::numeric) - -> Seq Scan on rlp4_1 rlp_6 + -> Seq Scan on rlp4_1 rlp_7 Filter: ((a)::numeric = '1'::numeric) - -> Seq Scan on rlp4_2 rlp_7 + -> Seq Scan on rlp4_2 rlp_8 Filter: ((a)::numeric = '1'::numeric) - -> Seq Scan on rlp4_default rlp_8 + -> Seq Scan on rlp4_default rlp_9 Filter: ((a)::numeric = '1'::numeric) - -> Seq Scan on rlp5_1 rlp_9 + -> Seq Scan on rlp5_1 rlp_10 Filter: ((a)::numeric = '1'::numeric) - -> Seq Scan on rlp5_default rlp_10 + -> Seq Scan on rlp5_default rlp_11 Filter: ((a)::numeric = '1'::numeric) - -> Seq Scan on rlp_default_10 rlp_11 + -> Seq Scan on rlp_default_10 rlp_12 Filter: ((a)::numeric = '1'::numeric) - -> Seq Scan on rlp_default_30 rlp_12 + -> Seq Scan on rlp_default_30 rlp_13 Filter: ((a)::numeric = '1'::numeric) - -> Seq Scan on rlp_default_null rlp_13 + -> Seq Scan on rlp_default_null rlp_14 Filter: ((a)::numeric = '1'::numeric) - -> Seq Scan on rlp_default_default rlp_14 + -> Seq Scan on rlp_default_default rlp_15 Filter: ((a)::numeric = '1'::numeric) (31 rows) @@ -267,13 +267,13 @@ explain (costs off) select * from rlp where a <= 10; QUERY PLAN --------------------------------------------- Append - -> Seq Scan on rlp1 rlp + -> Seq Scan on rlp1 rlp_1 Filter: (a <= 10) - -> Seq Scan on rlp2 rlp_1 + -> Seq Scan on rlp2 rlp_2 Filter: (a <= 10) - -> Seq Scan on rlp_default_10 rlp_2 + -> Seq Scan on rlp_default_10 rlp_3 Filter: (a <= 10) - -> Seq Scan on rlp_default_default rlp_3 + -> Seq Scan on rlp_default_default rlp_4 Filter: (a <= 10) (9 rows) @@ -281,27 +281,27 @@ explain (costs off) select * from rlp where a > 10; QUERY PLAN ---------------------------------------------- Append - -> Seq Scan on rlp3abcd rlp + -> Seq Scan on rlp3abcd rlp_1 Filter: (a > 10) - -> Seq Scan on rlp3efgh rlp_1 + -> Seq Scan on rlp3efgh rlp_2 Filter: (a > 10) - -> Seq Scan on rlp3nullxy rlp_2 + -> Seq Scan on rlp3nullxy rlp_3 Filter: (a > 10) - -> Seq Scan on rlp3_default rlp_3 + -> Seq Scan on rlp3_default rlp_4 Filter: (a > 10) - -> Seq Scan on rlp4_1 rlp_4 + -> Seq Scan on rlp4_1 rlp_5 Filter: (a > 10) - -> Seq Scan on rlp4_2 rlp_5 + -> Seq Scan on rlp4_2 rlp_6 Filter: (a > 10) - -> Seq Scan on rlp4_default rlp_6 + -> Seq Scan on rlp4_default rlp_7 Filter: (a > 10) - -> Seq Scan on rlp5_1 rlp_7 + -> Seq Scan on rlp5_1 rlp_8 Filter: (a > 10) - -> Seq Scan on rlp5_default rlp_8 + -> Seq Scan on rlp5_default rlp_9 Filter: (a > 10) - -> Seq Scan on rlp_default_30 rlp_9 + -> Seq Scan on rlp_default_30 rlp_10 Filter: (a > 10) - -> Seq Scan on rlp_default_default rlp_10 + -> Seq Scan on rlp_default_default rlp_11 Filter: (a > 10) (23 rows) @@ -309,13 +309,13 @@ explain (costs off) select * from rlp where a < 15; QUERY PLAN --------------------------------------------- Append - -> Seq Scan on rlp1 rlp + -> Seq Scan on rlp1 rlp_1 Filter: (a < 15) - -> Seq Scan on rlp2 rlp_1 + -> Seq Scan on rlp2 rlp_2 Filter: (a < 15) - -> Seq Scan on rlp_default_10 rlp_2 + -> Seq Scan on rlp_default_10 rlp_3 Filter: (a < 15) - -> Seq Scan on rlp_default_default rlp_3 + -> Seq Scan on rlp_default_default rlp_4 Filter: (a < 15) (9 rows) @@ -323,21 +323,21 @@ explain (costs off) select * from rlp where a <= 15; QUERY PLAN --------------------------------------------- Append - -> Seq Scan on rlp1 rlp + -> Seq Scan on rlp1 rlp_1 Filter: (a <= 15) - -> Seq Scan on rlp2 rlp_1 + -> Seq Scan on rlp2 rlp_2 Filter: (a <= 15) - -> Seq Scan on rlp3abcd rlp_2 + -> Seq Scan on rlp3abcd rlp_3 Filter: (a <= 15) - -> Seq Scan on rlp3efgh rlp_3 + -> Seq Scan on rlp3efgh rlp_4 Filter: (a <= 15) - -> Seq Scan on rlp3nullxy rlp_4 + -> Seq Scan on rlp3nullxy rlp_5 Filter: (a <= 15) - -> Seq Scan on rlp3_default rlp_5 + -> Seq Scan on rlp3_default rlp_6 Filter: (a <= 15) - -> Seq Scan on rlp_default_10 rlp_6 + -> Seq Scan on rlp_default_10 rlp_7 Filter: (a <= 15) - -> Seq Scan on rlp_default_default rlp_7 + -> Seq Scan on rlp_default_default rlp_8 Filter: (a <= 15) (17 rows) @@ -345,21 +345,21 @@ explain (costs off) select * from rlp where a > 15 and b = 'ab'; QUERY PLAN --------------------------------------------------------- Append - -> Seq Scan on rlp3abcd rlp + -> Seq Scan on rlp3abcd rlp_1 Filter: ((a > 15) AND ((b)::text = 'ab'::text)) - -> Seq Scan on rlp4_1 rlp_1 + -> Seq Scan on rlp4_1 rlp_2 Filter: ((a > 15) AND ((b)::text = 'ab'::text)) - -> Seq Scan on rlp4_2 rlp_2 + -> Seq Scan on rlp4_2 rlp_3 Filter: ((a > 15) AND ((b)::text = 'ab'::text)) - -> Seq Scan on rlp4_default rlp_3 + -> Seq Scan on rlp4_default rlp_4 Filter: ((a > 15) AND ((b)::text = 'ab'::text)) - -> Seq Scan on rlp5_1 rlp_4 + -> Seq Scan on rlp5_1 rlp_5 Filter: ((a > 15) AND ((b)::text = 'ab'::text)) - -> Seq Scan on rlp5_default rlp_5 + -> Seq Scan on rlp5_default rlp_6 Filter: ((a > 15) AND ((b)::text = 'ab'::text)) - -> Seq Scan on rlp_default_30 rlp_6 + -> Seq Scan on rlp_default_30 rlp_7 Filter: ((a > 15) AND ((b)::text = 'ab'::text)) - -> Seq Scan on rlp_default_default rlp_7 + -> Seq Scan on rlp_default_default rlp_8 Filter: ((a > 15) AND ((b)::text = 'ab'::text)) (17 rows) @@ -367,13 +367,13 @@ explain (costs off) select * from rlp where a = 16; QUERY PLAN -------------------------------------- Append - -> Seq Scan on rlp3abcd rlp + -> Seq Scan on rlp3abcd rlp_1 Filter: (a = 16) - -> Seq Scan on rlp3efgh rlp_1 + -> Seq Scan on rlp3efgh rlp_2 Filter: (a = 16) - -> Seq Scan on rlp3nullxy rlp_2 + -> Seq Scan on rlp3nullxy rlp_3 Filter: (a = 16) - -> Seq Scan on rlp3_default rlp_3 + -> Seq Scan on rlp3_default rlp_4 Filter: (a = 16) (9 rows) @@ -395,9 +395,9 @@ explain (costs off) select * from rlp where a = 16 and b <= 'ab'; QUERY PLAN ---------------------------------------------------------- Append - -> Seq Scan on rlp3abcd rlp + -> Seq Scan on rlp3abcd rlp_1 Filter: (((b)::text <= 'ab'::text) AND (a = 16)) - -> Seq Scan on rlp3_default rlp_1 + -> Seq Scan on rlp3_default rlp_2 Filter: (((b)::text <= 'ab'::text) AND (a = 16)) (5 rows) @@ -412,13 +412,13 @@ explain (costs off) select * from rlp where a = 16 and b is not null; QUERY PLAN ------------------------------------------------ Append - -> Seq Scan on rlp3abcd rlp + -> Seq Scan on rlp3abcd rlp_1 Filter: ((b IS NOT NULL) AND (a = 16)) - -> Seq Scan on rlp3efgh rlp_1 + -> Seq Scan on rlp3efgh rlp_2 Filter: ((b IS NOT NULL) AND (a = 16)) - -> Seq Scan on rlp3nullxy rlp_2 + -> Seq Scan on rlp3nullxy rlp_3 Filter: ((b IS NOT NULL) AND (a = 16)) - -> Seq Scan on rlp3_default rlp_3 + -> Seq Scan on rlp3_default rlp_4 Filter: ((b IS NOT NULL) AND (a = 16)) (9 rows) @@ -433,33 +433,33 @@ explain (costs off) select * from rlp where a is not null; QUERY PLAN ---------------------------------------------- Append - -> Seq Scan on rlp1 rlp + -> Seq Scan on rlp1 rlp_1 Filter: (a IS NOT NULL) - -> Seq Scan on rlp2 rlp_1 + -> Seq Scan on rlp2 rlp_2 Filter: (a IS NOT NULL) - -> Seq Scan on rlp3abcd rlp_2 + -> Seq Scan on rlp3abcd rlp_3 Filter: (a IS NOT NULL) - -> Seq Scan on rlp3efgh rlp_3 + -> Seq Scan on rlp3efgh rlp_4 Filter: (a IS NOT NULL) - -> Seq Scan on rlp3nullxy rlp_4 + -> Seq Scan on rlp3nullxy rlp_5 Filter: (a IS NOT NULL) - -> Seq Scan on rlp3_default rlp_5 + -> Seq Scan on rlp3_default rlp_6 Filter: (a IS NOT NULL) - -> Seq Scan on rlp4_1 rlp_6 + -> Seq Scan on rlp4_1 rlp_7 Filter: (a IS NOT NULL) - -> Seq Scan on rlp4_2 rlp_7 + -> Seq Scan on rlp4_2 rlp_8 Filter: (a IS NOT NULL) - -> Seq Scan on rlp4_default rlp_8 + -> Seq Scan on rlp4_default rlp_9 Filter: (a IS NOT NULL) - -> Seq Scan on rlp5_1 rlp_9 + -> Seq Scan on rlp5_1 rlp_10 Filter: (a IS NOT NULL) - -> Seq Scan on rlp5_default rlp_10 + -> Seq Scan on rlp5_default rlp_11 Filter: (a IS NOT NULL) - -> Seq Scan on rlp_default_10 rlp_11 + -> Seq Scan on rlp_default_10 rlp_12 Filter: (a IS NOT NULL) - -> Seq Scan on rlp_default_30 rlp_12 + -> Seq Scan on rlp_default_30 rlp_13 Filter: (a IS NOT NULL) - -> Seq Scan on rlp_default_default rlp_13 + -> Seq Scan on rlp_default_default rlp_14 Filter: (a IS NOT NULL) (29 rows) @@ -467,11 +467,11 @@ explain (costs off) select * from rlp where a > 30; QUERY PLAN --------------------------------------------- Append - -> Seq Scan on rlp5_1 rlp + -> Seq Scan on rlp5_1 rlp_1 Filter: (a > 30) - -> Seq Scan on rlp5_default rlp_1 + -> Seq Scan on rlp5_default rlp_2 Filter: (a > 30) - -> Seq Scan on rlp_default_default rlp_2 + -> Seq Scan on rlp_default_default rlp_3 Filter: (a > 30) (7 rows) @@ -486,31 +486,31 @@ explain (costs off) select * from rlp where a <= 31; QUERY PLAN ---------------------------------------------- Append - -> Seq Scan on rlp1 rlp + -> Seq Scan on rlp1 rlp_1 Filter: (a <= 31) - -> Seq Scan on rlp2 rlp_1 + -> Seq Scan on rlp2 rlp_2 Filter: (a <= 31) - -> Seq Scan on rlp3abcd rlp_2 + -> Seq Scan on rlp3abcd rlp_3 Filter: (a <= 31) - -> Seq Scan on rlp3efgh rlp_3 + -> Seq Scan on rlp3efgh rlp_4 Filter: (a <= 31) - -> Seq Scan on rlp3nullxy rlp_4 + -> Seq Scan on rlp3nullxy rlp_5 Filter: (a <= 31) - -> Seq Scan on rlp3_default rlp_5 + -> Seq Scan on rlp3_default rlp_6 Filter: (a <= 31) - -> Seq Scan on rlp4_1 rlp_6 + -> Seq Scan on rlp4_1 rlp_7 Filter: (a <= 31) - -> Seq Scan on rlp4_2 rlp_7 + -> Seq Scan on rlp4_2 rlp_8 Filter: (a <= 31) - -> Seq Scan on rlp4_default rlp_8 + -> Seq Scan on rlp4_default rlp_9 Filter: (a <= 31) - -> Seq Scan on rlp5_1 rlp_9 + -> Seq Scan on rlp5_1 rlp_10 Filter: (a <= 31) - -> Seq Scan on rlp_default_10 rlp_10 + -> Seq Scan on rlp_default_10 rlp_11 Filter: (a <= 31) - -> Seq Scan on rlp_default_30 rlp_11 + -> Seq Scan on rlp_default_30 rlp_12 Filter: (a <= 31) - -> Seq Scan on rlp_default_default rlp_12 + -> Seq Scan on rlp_default_default rlp_13 Filter: (a <= 31) (27 rows) @@ -525,29 +525,29 @@ explain (costs off) select * from rlp where a = 1 or b = 'ab'; QUERY PLAN ------------------------------------------------------- Append - -> Seq Scan on rlp1 rlp + -> Seq Scan on rlp1 rlp_1 Filter: ((a = 1) OR ((b)::text = 'ab'::text)) - -> Seq Scan on rlp2 rlp_1 + -> Seq Scan on rlp2 rlp_2 Filter: ((a = 1) OR ((b)::text = 'ab'::text)) - -> Seq Scan on rlp3abcd rlp_2 + -> Seq Scan on rlp3abcd rlp_3 Filter: ((a = 1) OR ((b)::text = 'ab'::text)) - -> Seq Scan on rlp4_1 rlp_3 + -> Seq Scan on rlp4_1 rlp_4 Filter: ((a = 1) OR ((b)::text = 'ab'::text)) - -> Seq Scan on rlp4_2 rlp_4 + -> Seq Scan on rlp4_2 rlp_5 Filter: ((a = 1) OR ((b)::text = 'ab'::text)) - -> Seq Scan on rlp4_default rlp_5 + -> Seq Scan on rlp4_default rlp_6 Filter: ((a = 1) OR ((b)::text = 'ab'::text)) - -> Seq Scan on rlp5_1 rlp_6 + -> Seq Scan on rlp5_1 rlp_7 Filter: ((a = 1) OR ((b)::text = 'ab'::text)) - -> Seq Scan on rlp5_default rlp_7 + -> Seq Scan on rlp5_default rlp_8 Filter: ((a = 1) OR ((b)::text = 'ab'::text)) - -> Seq Scan on rlp_default_10 rlp_8 + -> Seq Scan on rlp_default_10 rlp_9 Filter: ((a = 1) OR ((b)::text = 'ab'::text)) - -> Seq Scan on rlp_default_30 rlp_9 + -> Seq Scan on rlp_default_30 rlp_10 Filter: ((a = 1) OR ((b)::text = 'ab'::text)) - -> Seq Scan on rlp_default_null rlp_10 + -> Seq Scan on rlp_default_null rlp_11 Filter: ((a = 1) OR ((b)::text = 'ab'::text)) - -> Seq Scan on rlp_default_default rlp_11 + -> Seq Scan on rlp_default_default rlp_12 Filter: ((a = 1) OR ((b)::text = 'ab'::text)) (25 rows) @@ -555,9 +555,9 @@ explain (costs off) select * from rlp where a > 20 and a < 27; QUERY PLAN ----------------------------------------- Append - -> Seq Scan on rlp4_1 rlp + -> Seq Scan on rlp4_1 rlp_1 Filter: ((a > 20) AND (a < 27)) - -> Seq Scan on rlp4_2 rlp_1 + -> Seq Scan on rlp4_2 rlp_2 Filter: ((a > 20) AND (a < 27)) (5 rows) @@ -572,15 +572,15 @@ explain (costs off) select * from rlp where a >= 29; QUERY PLAN --------------------------------------------- Append - -> Seq Scan on rlp4_default rlp + -> Seq Scan on rlp4_default rlp_1 Filter: (a >= 29) - -> Seq Scan on rlp5_1 rlp_1 + -> Seq Scan on rlp5_1 rlp_2 Filter: (a >= 29) - -> Seq Scan on rlp5_default rlp_2 + -> Seq Scan on rlp5_default rlp_3 Filter: (a >= 29) - -> Seq Scan on rlp_default_30 rlp_3 + -> Seq Scan on rlp_default_30 rlp_4 Filter: (a >= 29) - -> Seq Scan on rlp_default_default rlp_4 + -> Seq Scan on rlp_default_default rlp_5 Filter: (a >= 29) (11 rows) @@ -588,9 +588,9 @@ explain (costs off) select * from rlp where a < 1 or (a > 20 and a < 25); QUERY PLAN ------------------------------------------------------ Append - -> Seq Scan on rlp1 rlp + -> Seq Scan on rlp1 rlp_1 Filter: ((a < 1) OR ((a > 20) AND (a < 25))) - -> Seq Scan on rlp4_1 rlp_1 + -> Seq Scan on rlp4_1 rlp_2 Filter: ((a < 1) OR ((a > 20) AND (a < 25))) (5 rows) @@ -599,9 +599,9 @@ explain (costs off) select * from rlp where a = 20 or a = 40; QUERY PLAN ---------------------------------------- Append - -> Seq Scan on rlp4_1 rlp + -> Seq Scan on rlp4_1 rlp_1 Filter: ((a = 20) OR (a = 40)) - -> Seq Scan on rlp5_default rlp_1 + -> Seq Scan on rlp5_default rlp_2 Filter: ((a = 20) OR (a = 40)) (5 rows) @@ -624,27 +624,27 @@ explain (costs off) select * from rlp where a > 1 and a >=15; /* rlp3 onwards, i QUERY PLAN ---------------------------------------------- Append - -> Seq Scan on rlp3abcd rlp + -> Seq Scan on rlp3abcd rlp_1 Filter: ((a > 1) AND (a >= 15)) - -> Seq Scan on rlp3efgh rlp_1 + -> Seq Scan on rlp3efgh rlp_2 Filter: ((a > 1) AND (a >= 15)) - -> Seq Scan on rlp3nullxy rlp_2 + -> Seq Scan on rlp3nullxy rlp_3 Filter: ((a > 1) AND (a >= 15)) - -> Seq Scan on rlp3_default rlp_3 + -> Seq Scan on rlp3_default rlp_4 Filter: ((a > 1) AND (a >= 15)) - -> Seq Scan on rlp4_1 rlp_4 + -> Seq Scan on rlp4_1 rlp_5 Filter: ((a > 1) AND (a >= 15)) - -> Seq Scan on rlp4_2 rlp_5 + -> Seq Scan on rlp4_2 rlp_6 Filter: ((a > 1) AND (a >= 15)) - -> Seq Scan on rlp4_default rlp_6 + -> Seq Scan on rlp4_default rlp_7 Filter: ((a > 1) AND (a >= 15)) - -> Seq Scan on rlp5_1 rlp_7 + -> Seq Scan on rlp5_1 rlp_8 Filter: ((a > 1) AND (a >= 15)) - -> Seq Scan on rlp5_default rlp_8 + -> Seq Scan on rlp5_default rlp_9 Filter: ((a > 1) AND (a >= 15)) - -> Seq Scan on rlp_default_30 rlp_9 + -> Seq Scan on rlp_default_30 rlp_10 Filter: ((a > 1) AND (a >= 15)) - -> Seq Scan on rlp_default_default rlp_10 + -> Seq Scan on rlp_default_default rlp_11 Filter: ((a > 1) AND (a >= 15)) (23 rows) @@ -659,15 +659,15 @@ explain (costs off) select * from rlp where (a = 1 and a = 3) or (a > 1 and a = QUERY PLAN ------------------------------------------------------------------- Append - -> Seq Scan on rlp2 rlp + -> Seq Scan on rlp2 rlp_1 Filter: (((a = 1) AND (a = 3)) OR ((a > 1) AND (a = 15))) - -> Seq Scan on rlp3abcd rlp_1 + -> Seq Scan on rlp3abcd rlp_2 Filter: (((a = 1) AND (a = 3)) OR ((a > 1) AND (a = 15))) - -> Seq Scan on rlp3efgh rlp_2 + -> Seq Scan on rlp3efgh rlp_3 Filter: (((a = 1) AND (a = 3)) OR ((a > 1) AND (a = 15))) - -> Seq Scan on rlp3nullxy rlp_3 + -> Seq Scan on rlp3nullxy rlp_4 Filter: (((a = 1) AND (a = 3)) OR ((a > 1) AND (a = 15))) - -> Seq Scan on rlp3_default rlp_4 + -> Seq Scan on rlp3_default rlp_5 Filter: (((a = 1) AND (a = 3)) OR ((a > 1) AND (a = 15))) (11 rows) @@ -686,11 +686,11 @@ explain (costs off) select * from mc3p where a = 1; QUERY PLAN --------------------------------------- Append - -> Seq Scan on mc3p0 mc3p + -> Seq Scan on mc3p0 mc3p_1 Filter: (a = 1) - -> Seq Scan on mc3p1 mc3p_1 + -> Seq Scan on mc3p1 mc3p_2 Filter: (a = 1) - -> Seq Scan on mc3p_default mc3p_2 + -> Seq Scan on mc3p_default mc3p_3 Filter: (a = 1) (7 rows) @@ -698,9 +698,9 @@ explain (costs off) select * from mc3p where a = 1 and abs(b) < 1; QUERY PLAN -------------------------------------------- Append - -> Seq Scan on mc3p0 mc3p + -> Seq Scan on mc3p0 mc3p_1 Filter: ((a = 1) AND (abs(b) < 1)) - -> Seq Scan on mc3p_default mc3p_1 + -> Seq Scan on mc3p_default mc3p_2 Filter: ((a = 1) AND (abs(b) < 1)) (5 rows) @@ -708,11 +708,11 @@ explain (costs off) select * from mc3p where a = 1 and abs(b) = 1; QUERY PLAN -------------------------------------------- Append - -> Seq Scan on mc3p0 mc3p + -> Seq Scan on mc3p0 mc3p_1 Filter: ((a = 1) AND (abs(b) = 1)) - -> Seq Scan on mc3p1 mc3p_1 + -> Seq Scan on mc3p1 mc3p_2 Filter: ((a = 1) AND (abs(b) = 1)) - -> Seq Scan on mc3p_default mc3p_2 + -> Seq Scan on mc3p_default mc3p_3 Filter: ((a = 1) AND (abs(b) = 1)) (7 rows) @@ -720,9 +720,9 @@ explain (costs off) select * from mc3p where a = 1 and abs(b) = 1 and c < 8; QUERY PLAN -------------------------------------------------------- Append - -> Seq Scan on mc3p0 mc3p + -> Seq Scan on mc3p0 mc3p_1 Filter: ((c < 8) AND (a = 1) AND (abs(b) = 1)) - -> Seq Scan on mc3p1 mc3p_1 + -> Seq Scan on mc3p1 mc3p_2 Filter: ((c < 8) AND (a = 1) AND (abs(b) = 1)) (5 rows) @@ -730,15 +730,15 @@ explain (costs off) select * from mc3p where a = 10 and abs(b) between 5 and 35; QUERY PLAN ----------------------------------------------------------------- Append - -> Seq Scan on mc3p1 mc3p + -> Seq Scan on mc3p1 mc3p_1 Filter: ((a = 10) AND (abs(b) >= 5) AND (abs(b) <= 35)) - -> Seq Scan on mc3p2 mc3p_1 + -> Seq Scan on mc3p2 mc3p_2 Filter: ((a = 10) AND (abs(b) >= 5) AND (abs(b) <= 35)) - -> Seq Scan on mc3p3 mc3p_2 + -> Seq Scan on mc3p3 mc3p_3 Filter: ((a = 10) AND (abs(b) >= 5) AND (abs(b) <= 35)) - -> Seq Scan on mc3p4 mc3p_3 + -> Seq Scan on mc3p4 mc3p_4 Filter: ((a = 10) AND (abs(b) >= 5) AND (abs(b) <= 35)) - -> Seq Scan on mc3p_default mc3p_4 + -> Seq Scan on mc3p_default mc3p_5 Filter: ((a = 10) AND (abs(b) >= 5) AND (abs(b) <= 35)) (11 rows) @@ -746,13 +746,13 @@ explain (costs off) select * from mc3p where a > 10; QUERY PLAN --------------------------------------- Append - -> Seq Scan on mc3p5 mc3p + -> Seq Scan on mc3p5 mc3p_1 Filter: (a > 10) - -> Seq Scan on mc3p6 mc3p_1 + -> Seq Scan on mc3p6 mc3p_2 Filter: (a > 10) - -> Seq Scan on mc3p7 mc3p_2 + -> Seq Scan on mc3p7 mc3p_3 Filter: (a > 10) - -> Seq Scan on mc3p_default mc3p_3 + -> Seq Scan on mc3p_default mc3p_4 Filter: (a > 10) (9 rows) @@ -760,21 +760,21 @@ explain (costs off) select * from mc3p where a >= 10; QUERY PLAN --------------------------------------- Append - -> Seq Scan on mc3p1 mc3p + -> Seq Scan on mc3p1 mc3p_1 Filter: (a >= 10) - -> Seq Scan on mc3p2 mc3p_1 + -> Seq Scan on mc3p2 mc3p_2 Filter: (a >= 10) - -> Seq Scan on mc3p3 mc3p_2 + -> Seq Scan on mc3p3 mc3p_3 Filter: (a >= 10) - -> Seq Scan on mc3p4 mc3p_3 + -> Seq Scan on mc3p4 mc3p_4 Filter: (a >= 10) - -> Seq Scan on mc3p5 mc3p_4 + -> Seq Scan on mc3p5 mc3p_5 Filter: (a >= 10) - -> Seq Scan on mc3p6 mc3p_5 + -> Seq Scan on mc3p6 mc3p_6 Filter: (a >= 10) - -> Seq Scan on mc3p7 mc3p_6 + -> Seq Scan on mc3p7 mc3p_7 Filter: (a >= 10) - -> Seq Scan on mc3p_default mc3p_7 + -> Seq Scan on mc3p_default mc3p_8 Filter: (a >= 10) (17 rows) @@ -782,11 +782,11 @@ explain (costs off) select * from mc3p where a < 10; QUERY PLAN --------------------------------------- Append - -> Seq Scan on mc3p0 mc3p + -> Seq Scan on mc3p0 mc3p_1 Filter: (a < 10) - -> Seq Scan on mc3p1 mc3p_1 + -> Seq Scan on mc3p1 mc3p_2 Filter: (a < 10) - -> Seq Scan on mc3p_default mc3p_2 + -> Seq Scan on mc3p_default mc3p_3 Filter: (a < 10) (7 rows) @@ -794,13 +794,13 @@ explain (costs off) select * from mc3p where a <= 10 and abs(b) < 10; QUERY PLAN ----------------------------------------------- Append - -> Seq Scan on mc3p0 mc3p + -> Seq Scan on mc3p0 mc3p_1 Filter: ((a <= 10) AND (abs(b) < 10)) - -> Seq Scan on mc3p1 mc3p_1 + -> Seq Scan on mc3p1 mc3p_2 Filter: ((a <= 10) AND (abs(b) < 10)) - -> Seq Scan on mc3p2 mc3p_2 + -> Seq Scan on mc3p2 mc3p_3 Filter: ((a <= 10) AND (abs(b) < 10)) - -> Seq Scan on mc3p_default mc3p_3 + -> Seq Scan on mc3p_default mc3p_4 Filter: ((a <= 10) AND (abs(b) < 10)) (9 rows) @@ -822,9 +822,9 @@ explain (costs off) select * from mc3p where a > 20; QUERY PLAN --------------------------------------- Append - -> Seq Scan on mc3p7 mc3p + -> Seq Scan on mc3p7 mc3p_1 Filter: (a > 20) - -> Seq Scan on mc3p_default mc3p_1 + -> Seq Scan on mc3p_default mc3p_2 Filter: (a > 20) (5 rows) @@ -832,13 +832,13 @@ explain (costs off) select * from mc3p where a >= 20; QUERY PLAN --------------------------------------- Append - -> Seq Scan on mc3p5 mc3p + -> Seq Scan on mc3p5 mc3p_1 Filter: (a >= 20) - -> Seq Scan on mc3p6 mc3p_1 + -> Seq Scan on mc3p6 mc3p_2 Filter: (a >= 20) - -> Seq Scan on mc3p7 mc3p_2 + -> Seq Scan on mc3p7 mc3p_3 Filter: (a >= 20) - -> Seq Scan on mc3p_default mc3p_3 + -> Seq Scan on mc3p_default mc3p_4 Filter: (a >= 20) (9 rows) @@ -846,13 +846,13 @@ explain (costs off) select * from mc3p where (a = 1 and abs(b) = 1 and c = 1) or QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------- Append - -> Seq Scan on mc3p1 mc3p + -> Seq Scan on mc3p1 mc3p_1 Filter: (((a = 1) AND (abs(b) = 1) AND (c = 1)) OR ((a = 10) AND (abs(b) = 5) AND (c = 10)) OR ((a > 11) AND (a < 20))) - -> Seq Scan on mc3p2 mc3p_1 + -> Seq Scan on mc3p2 mc3p_2 Filter: (((a = 1) AND (abs(b) = 1) AND (c = 1)) OR ((a = 10) AND (abs(b) = 5) AND (c = 10)) OR ((a > 11) AND (a < 20))) - -> Seq Scan on mc3p5 mc3p_2 + -> Seq Scan on mc3p5 mc3p_3 Filter: (((a = 1) AND (abs(b) = 1) AND (c = 1)) OR ((a = 10) AND (abs(b) = 5) AND (c = 10)) OR ((a > 11) AND (a < 20))) - -> Seq Scan on mc3p_default mc3p_3 + -> Seq Scan on mc3p_default mc3p_4 Filter: (((a = 1) AND (abs(b) = 1) AND (c = 1)) OR ((a = 10) AND (abs(b) = 5) AND (c = 10)) OR ((a > 11) AND (a < 20))) (9 rows) @@ -860,15 +860,15 @@ explain (costs off) select * from mc3p where (a = 1 and abs(b) = 1 and c = 1) or QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------- Append - -> Seq Scan on mc3p0 mc3p + -> Seq Scan on mc3p0 mc3p_1 Filter: (((a = 1) AND (abs(b) = 1) AND (c = 1)) OR ((a = 10) AND (abs(b) = 5) AND (c = 10)) OR ((a > 11) AND (a < 20)) OR (a < 1)) - -> Seq Scan on mc3p1 mc3p_1 + -> Seq Scan on mc3p1 mc3p_2 Filter: (((a = 1) AND (abs(b) = 1) AND (c = 1)) OR ((a = 10) AND (abs(b) = 5) AND (c = 10)) OR ((a > 11) AND (a < 20)) OR (a < 1)) - -> Seq Scan on mc3p2 mc3p_2 + -> Seq Scan on mc3p2 mc3p_3 Filter: (((a = 1) AND (abs(b) = 1) AND (c = 1)) OR ((a = 10) AND (abs(b) = 5) AND (c = 10)) OR ((a > 11) AND (a < 20)) OR (a < 1)) - -> Seq Scan on mc3p5 mc3p_3 + -> Seq Scan on mc3p5 mc3p_4 Filter: (((a = 1) AND (abs(b) = 1) AND (c = 1)) OR ((a = 10) AND (abs(b) = 5) AND (c = 10)) OR ((a > 11) AND (a < 20)) OR (a < 1)) - -> Seq Scan on mc3p_default mc3p_4 + -> Seq Scan on mc3p_default mc3p_5 Filter: (((a = 1) AND (abs(b) = 1) AND (c = 1)) OR ((a = 10) AND (abs(b) = 5) AND (c = 10)) OR ((a > 11) AND (a < 20)) OR (a < 1)) (11 rows) @@ -876,15 +876,15 @@ explain (costs off) select * from mc3p where (a = 1 and abs(b) = 1 and c = 1) or QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------- Append - -> Seq Scan on mc3p0 mc3p + -> Seq Scan on mc3p0 mc3p_1 Filter: (((a = 1) AND (abs(b) = 1) AND (c = 1)) OR ((a = 10) AND (abs(b) = 5) AND (c = 10)) OR ((a > 11) AND (a < 20)) OR (a < 1) OR (a = 1)) - -> Seq Scan on mc3p1 mc3p_1 + -> Seq Scan on mc3p1 mc3p_2 Filter: (((a = 1) AND (abs(b) = 1) AND (c = 1)) OR ((a = 10) AND (abs(b) = 5) AND (c = 10)) OR ((a > 11) AND (a < 20)) OR (a < 1) OR (a = 1)) - -> Seq Scan on mc3p2 mc3p_2 + -> Seq Scan on mc3p2 mc3p_3 Filter: (((a = 1) AND (abs(b) = 1) AND (c = 1)) OR ((a = 10) AND (abs(b) = 5) AND (c = 10)) OR ((a > 11) AND (a < 20)) OR (a < 1) OR (a = 1)) - -> Seq Scan on mc3p5 mc3p_3 + -> Seq Scan on mc3p5 mc3p_4 Filter: (((a = 1) AND (abs(b) = 1) AND (c = 1)) OR ((a = 10) AND (abs(b) = 5) AND (c = 10)) OR ((a > 11) AND (a < 20)) OR (a < 1) OR (a = 1)) - -> Seq Scan on mc3p_default mc3p_4 + -> Seq Scan on mc3p_default mc3p_5 Filter: (((a = 1) AND (abs(b) = 1) AND (c = 1)) OR ((a = 10) AND (abs(b) = 5) AND (c = 10)) OR ((a > 11) AND (a < 20)) OR (a < 1) OR (a = 1)) (11 rows) @@ -892,23 +892,23 @@ explain (costs off) select * from mc3p where a = 1 or abs(b) = 1 or c = 1; QUERY PLAN ------------------------------------------------------ Append - -> Seq Scan on mc3p0 mc3p + -> Seq Scan on mc3p0 mc3p_1 Filter: ((a = 1) OR (abs(b) = 1) OR (c = 1)) - -> Seq Scan on mc3p1 mc3p_1 + -> Seq Scan on mc3p1 mc3p_2 Filter: ((a = 1) OR (abs(b) = 1) OR (c = 1)) - -> Seq Scan on mc3p2 mc3p_2 + -> Seq Scan on mc3p2 mc3p_3 Filter: ((a = 1) OR (abs(b) = 1) OR (c = 1)) - -> Seq Scan on mc3p3 mc3p_3 + -> Seq Scan on mc3p3 mc3p_4 Filter: ((a = 1) OR (abs(b) = 1) OR (c = 1)) - -> Seq Scan on mc3p4 mc3p_4 + -> Seq Scan on mc3p4 mc3p_5 Filter: ((a = 1) OR (abs(b) = 1) OR (c = 1)) - -> Seq Scan on mc3p5 mc3p_5 + -> Seq Scan on mc3p5 mc3p_6 Filter: ((a = 1) OR (abs(b) = 1) OR (c = 1)) - -> Seq Scan on mc3p6 mc3p_6 + -> Seq Scan on mc3p6 mc3p_7 Filter: ((a = 1) OR (abs(b) = 1) OR (c = 1)) - -> Seq Scan on mc3p7 mc3p_7 + -> Seq Scan on mc3p7 mc3p_8 Filter: ((a = 1) OR (abs(b) = 1) OR (c = 1)) - -> Seq Scan on mc3p_default mc3p_8 + -> Seq Scan on mc3p_default mc3p_9 Filter: ((a = 1) OR (abs(b) = 1) OR (c = 1)) (19 rows) @@ -916,17 +916,17 @@ explain (costs off) select * from mc3p where (a = 1 and abs(b) = 1) or (a = 10 a QUERY PLAN ------------------------------------------------------------------------------ Append - -> Seq Scan on mc3p0 mc3p + -> Seq Scan on mc3p0 mc3p_1 Filter: (((a = 1) AND (abs(b) = 1)) OR ((a = 10) AND (abs(b) = 10))) - -> Seq Scan on mc3p1 mc3p_1 + -> Seq Scan on mc3p1 mc3p_2 Filter: (((a = 1) AND (abs(b) = 1)) OR ((a = 10) AND (abs(b) = 10))) - -> Seq Scan on mc3p2 mc3p_2 + -> Seq Scan on mc3p2 mc3p_3 Filter: (((a = 1) AND (abs(b) = 1)) OR ((a = 10) AND (abs(b) = 10))) - -> Seq Scan on mc3p3 mc3p_3 + -> Seq Scan on mc3p3 mc3p_4 Filter: (((a = 1) AND (abs(b) = 1)) OR ((a = 10) AND (abs(b) = 10))) - -> Seq Scan on mc3p4 mc3p_4 + -> Seq Scan on mc3p4 mc3p_5 Filter: (((a = 1) AND (abs(b) = 1)) OR ((a = 10) AND (abs(b) = 10))) - -> Seq Scan on mc3p_default mc3p_5 + -> Seq Scan on mc3p_default mc3p_6 Filter: (((a = 1) AND (abs(b) = 1)) OR ((a = 10) AND (abs(b) = 10))) (13 rows) @@ -934,13 +934,13 @@ explain (costs off) select * from mc3p where (a = 1 and abs(b) = 1) or (a = 10 a QUERY PLAN ----------------------------------------------------------------------------- Append - -> Seq Scan on mc3p0 mc3p + -> Seq Scan on mc3p0 mc3p_1 Filter: (((a = 1) AND (abs(b) = 1)) OR ((a = 10) AND (abs(b) = 9))) - -> Seq Scan on mc3p1 mc3p_1 + -> Seq Scan on mc3p1 mc3p_2 Filter: (((a = 1) AND (abs(b) = 1)) OR ((a = 10) AND (abs(b) = 9))) - -> Seq Scan on mc3p2 mc3p_2 + -> Seq Scan on mc3p2 mc3p_3 Filter: (((a = 1) AND (abs(b) = 1)) OR ((a = 10) AND (abs(b) = 9))) - -> Seq Scan on mc3p_default mc3p_3 + -> Seq Scan on mc3p_default mc3p_4 Filter: (((a = 1) AND (abs(b) = 1)) OR ((a = 10) AND (abs(b) = 9))) (9 rows) @@ -957,13 +957,13 @@ explain (costs off) select * from mc2p where a < 2; QUERY PLAN --------------------------------------- Append - -> Seq Scan on mc2p0 mc2p + -> Seq Scan on mc2p0 mc2p_1 Filter: (a < 2) - -> Seq Scan on mc2p1 mc2p_1 + -> Seq Scan on mc2p1 mc2p_2 Filter: (a < 2) - -> Seq Scan on mc2p2 mc2p_2 + -> Seq Scan on mc2p2 mc2p_3 Filter: (a < 2) - -> Seq Scan on mc2p_default mc2p_3 + -> Seq Scan on mc2p_default mc2p_4 Filter: (a < 2) (9 rows) @@ -978,15 +978,15 @@ explain (costs off) select * from mc2p where a > 1; QUERY PLAN --------------------------------------- Append - -> Seq Scan on mc2p2 mc2p + -> Seq Scan on mc2p2 mc2p_1 Filter: (a > 1) - -> Seq Scan on mc2p3 mc2p_1 + -> Seq Scan on mc2p3 mc2p_2 Filter: (a > 1) - -> Seq Scan on mc2p4 mc2p_2 + -> Seq Scan on mc2p4 mc2p_3 Filter: (a > 1) - -> Seq Scan on mc2p5 mc2p_3 + -> Seq Scan on mc2p5 mc2p_4 Filter: (a > 1) - -> Seq Scan on mc2p_default mc2p_4 + -> Seq Scan on mc2p_default mc2p_5 Filter: (a > 1) (11 rows) @@ -1042,9 +1042,9 @@ explain (costs off) select * from boolpart where a in (true, false); QUERY PLAN ------------------------------------------------ Append - -> Seq Scan on boolpart_f boolpart + -> Seq Scan on boolpart_f boolpart_1 Filter: (a = ANY ('{t,f}'::boolean[])) - -> Seq Scan on boolpart_t boolpart_1 + -> Seq Scan on boolpart_t boolpart_2 Filter: (a = ANY ('{t,f}'::boolean[])) (5 rows) @@ -1066,9 +1066,9 @@ explain (costs off) select * from boolpart where a is true or a is not true; QUERY PLAN -------------------------------------------------- Append - -> Seq Scan on boolpart_f boolpart + -> Seq Scan on boolpart_f boolpart_1 Filter: ((a IS TRUE) OR (a IS NOT TRUE)) - -> Seq Scan on boolpart_t boolpart_1 + -> Seq Scan on boolpart_t boolpart_2 Filter: ((a IS TRUE) OR (a IS NOT TRUE)) (5 rows) @@ -1090,11 +1090,11 @@ explain (costs off) select * from boolpart where a is unknown; QUERY PLAN ----------------------------------------------- Append - -> Seq Scan on boolpart_f boolpart + -> Seq Scan on boolpart_f boolpart_1 Filter: (a IS UNKNOWN) - -> Seq Scan on boolpart_t boolpart_1 + -> Seq Scan on boolpart_t boolpart_2 Filter: (a IS UNKNOWN) - -> Seq Scan on boolpart_default boolpart_2 + -> Seq Scan on boolpart_default boolpart_3 Filter: (a IS UNKNOWN) (7 rows) @@ -1102,11 +1102,11 @@ explain (costs off) select * from boolpart where a is not unknown; QUERY PLAN ----------------------------------------------- Append - -> Seq Scan on boolpart_f boolpart + -> Seq Scan on boolpart_f boolpart_1 Filter: (a IS NOT UNKNOWN) - -> Seq Scan on boolpart_t boolpart_1 + -> Seq Scan on boolpart_t boolpart_2 Filter: (a IS NOT UNKNOWN) - -> Seq Scan on boolpart_default boolpart_2 + -> Seq Scan on boolpart_default boolpart_3 Filter: (a IS NOT UNKNOWN) (7 rows) @@ -1132,11 +1132,11 @@ explain (costs off) select * from coercepart where a in ('ab', to_char(125, '999 QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ Append - -> Seq Scan on coercepart_ab coercepart + -> Seq Scan on coercepart_ab coercepart_1 Filter: ((a)::text = ANY ((ARRAY['ab'::character varying, (to_char(125, '999'::text))::character varying])::text[])) - -> Seq Scan on coercepart_bc coercepart_1 + -> Seq Scan on coercepart_bc coercepart_2 Filter: ((a)::text = ANY ((ARRAY['ab'::character varying, (to_char(125, '999'::text))::character varying])::text[])) - -> Seq Scan on coercepart_cd coercepart_2 + -> Seq Scan on coercepart_cd coercepart_3 Filter: ((a)::text = ANY ((ARRAY['ab'::character varying, (to_char(125, '999'::text))::character varying])::text[])) (7 rows) @@ -1144,11 +1144,11 @@ explain (costs off) select * from coercepart where a ~ any ('{ab}'); QUERY PLAN ---------------------------------------------------- Append - -> Seq Scan on coercepart_ab coercepart + -> Seq Scan on coercepart_ab coercepart_1 Filter: ((a)::text ~ ANY ('{ab}'::text[])) - -> Seq Scan on coercepart_bc coercepart_1 + -> Seq Scan on coercepart_bc coercepart_2 Filter: ((a)::text ~ ANY ('{ab}'::text[])) - -> Seq Scan on coercepart_cd coercepart_2 + -> Seq Scan on coercepart_cd coercepart_3 Filter: ((a)::text ~ ANY ('{ab}'::text[])) (7 rows) @@ -1156,11 +1156,11 @@ explain (costs off) select * from coercepart where a !~ all ('{ab}'); QUERY PLAN ----------------------------------------------------- Append - -> Seq Scan on coercepart_ab coercepart + -> Seq Scan on coercepart_ab coercepart_1 Filter: ((a)::text !~ ALL ('{ab}'::text[])) - -> Seq Scan on coercepart_bc coercepart_1 + -> Seq Scan on coercepart_bc coercepart_2 Filter: ((a)::text !~ ALL ('{ab}'::text[])) - -> Seq Scan on coercepart_cd coercepart_2 + -> Seq Scan on coercepart_cd coercepart_3 Filter: ((a)::text !~ ALL ('{ab}'::text[])) (7 rows) @@ -1168,11 +1168,11 @@ explain (costs off) select * from coercepart where a ~ any ('{ab,bc}'); QUERY PLAN ------------------------------------------------------- Append - -> Seq Scan on coercepart_ab coercepart + -> Seq Scan on coercepart_ab coercepart_1 Filter: ((a)::text ~ ANY ('{ab,bc}'::text[])) - -> Seq Scan on coercepart_bc coercepart_1 + -> Seq Scan on coercepart_bc coercepart_2 Filter: ((a)::text ~ ANY ('{ab,bc}'::text[])) - -> Seq Scan on coercepart_cd coercepart_2 + -> Seq Scan on coercepart_cd coercepart_3 Filter: ((a)::text ~ ANY ('{ab,bc}'::text[])) (7 rows) @@ -1180,11 +1180,11 @@ explain (costs off) select * from coercepart where a !~ all ('{ab,bc}'); QUERY PLAN -------------------------------------------------------- Append - -> Seq Scan on coercepart_ab coercepart + -> Seq Scan on coercepart_ab coercepart_1 Filter: ((a)::text !~ ALL ('{ab,bc}'::text[])) - -> Seq Scan on coercepart_bc coercepart_1 + -> Seq Scan on coercepart_bc coercepart_2 Filter: ((a)::text !~ ALL ('{ab,bc}'::text[])) - -> Seq Scan on coercepart_cd coercepart_2 + -> Seq Scan on coercepart_cd coercepart_3 Filter: ((a)::text !~ ALL ('{ab,bc}'::text[])) (7 rows) @@ -1192,9 +1192,9 @@ explain (costs off) select * from coercepart where a = any ('{ab,bc}'); QUERY PLAN ------------------------------------------------------- Append - -> Seq Scan on coercepart_ab coercepart + -> Seq Scan on coercepart_ab coercepart_1 Filter: ((a)::text = ANY ('{ab,bc}'::text[])) - -> Seq Scan on coercepart_bc coercepart_1 + -> Seq Scan on coercepart_bc coercepart_2 Filter: ((a)::text = ANY ('{ab,bc}'::text[])) (5 rows) @@ -1268,12 +1268,12 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM part p(x) ORDER BY x; Output: p.x, p.b Sort Key: p.x -> Append - -> Seq Scan on public.part_p1 p - Output: p.x, p.b - -> Seq Scan on public.part_rev p_1 + -> Seq Scan on public.part_p1 p_1 Output: p_1.x, p_1.b - -> Seq Scan on public.part_p2_p1 p_2 + -> Seq Scan on public.part_rev p_2 Output: p_2.x, p_2.b + -> Seq Scan on public.part_p2_p1 p_3 + Output: p_3.x, p_3.b (10 rows) -- @@ -1288,31 +1288,31 @@ explain (costs off) select * from mc2p t1, lateral (select count(*) from mc3p t2 ----------------------------------------------------------------------- Nested Loop -> Append - -> Seq Scan on mc2p1 t1 + -> Seq Scan on mc2p1 t1_1 Filter: (a = 1) - -> Seq Scan on mc2p2 t1_1 + -> Seq Scan on mc2p2 t1_2 Filter: (a = 1) - -> Seq Scan on mc2p_default t1_2 + -> Seq Scan on mc2p_default t1_3 Filter: (a = 1) -> Aggregate -> Append - -> Seq Scan on mc3p0 t2 + -> Seq Scan on mc3p0 t2_1 Filter: ((a = t1.b) AND (c = 1) AND (abs(b) = 1)) - -> Seq Scan on mc3p1 t2_1 + -> Seq Scan on mc3p1 t2_2 Filter: ((a = t1.b) AND (c = 1) AND (abs(b) = 1)) - -> Seq Scan on mc3p2 t2_2 + -> Seq Scan on mc3p2 t2_3 Filter: ((a = t1.b) AND (c = 1) AND (abs(b) = 1)) - -> Seq Scan on mc3p3 t2_3 + -> Seq Scan on mc3p3 t2_4 Filter: ((a = t1.b) AND (c = 1) AND (abs(b) = 1)) - -> Seq Scan on mc3p4 t2_4 + -> Seq Scan on mc3p4 t2_5 Filter: ((a = t1.b) AND (c = 1) AND (abs(b) = 1)) - -> Seq Scan on mc3p5 t2_5 + -> Seq Scan on mc3p5 t2_6 Filter: ((a = t1.b) AND (c = 1) AND (abs(b) = 1)) - -> Seq Scan on mc3p6 t2_6 + -> Seq Scan on mc3p6 t2_7 Filter: ((a = t1.b) AND (c = 1) AND (abs(b) = 1)) - -> Seq Scan on mc3p7 t2_7 + -> Seq Scan on mc3p7 t2_8 Filter: ((a = t1.b) AND (c = 1) AND (abs(b) = 1)) - -> Seq Scan on mc3p_default t2_8 + -> Seq Scan on mc3p_default t2_9 Filter: ((a = t1.b) AND (c = 1) AND (abs(b) = 1)) (28 rows) @@ -1323,19 +1323,19 @@ explain (costs off) select * from mc2p t1, lateral (select count(*) from mc3p t2 ----------------------------------------------------------------------- Nested Loop -> Append - -> Seq Scan on mc2p1 t1 + -> Seq Scan on mc2p1 t1_1 Filter: (a = 1) - -> Seq Scan on mc2p2 t1_1 + -> Seq Scan on mc2p2 t1_2 Filter: (a = 1) - -> Seq Scan on mc2p_default t1_2 + -> Seq Scan on mc2p_default t1_3 Filter: (a = 1) -> Aggregate -> Append - -> Seq Scan on mc3p0 t2 + -> Seq Scan on mc3p0 t2_1 Filter: ((c = t1.b) AND (a = 1) AND (abs(b) = 1)) - -> Seq Scan on mc3p1 t2_1 + -> Seq Scan on mc3p1 t2_2 Filter: ((c = t1.b) AND (a = 1) AND (abs(b) = 1)) - -> Seq Scan on mc3p_default t2_2 + -> Seq Scan on mc3p_default t2_3 Filter: ((c = t1.b) AND (a = 1) AND (abs(b) = 1)) (16 rows) @@ -1348,11 +1348,11 @@ explain (costs off) select * from mc2p t1, lateral (select count(*) from mc3p t2 -> Seq Scan on mc3p1 t2 Filter: ((a = 1) AND (c = 1) AND (abs(b) = 1)) -> Append - -> Seq Scan on mc2p1 t1 + -> Seq Scan on mc2p1 t1_1 Filter: (a = 1) - -> Seq Scan on mc2p2 t1_1 + -> Seq Scan on mc2p2 t1_2 Filter: (a = 1) - -> Seq Scan on mc2p_default t1_2 + -> Seq Scan on mc2p_default t1_3 Filter: (a = 1) (11 rows) @@ -1368,11 +1368,11 @@ explain (costs off) select * from rp where a <> 1; QUERY PLAN ---------------------------- Append - -> Seq Scan on rp0 rp + -> Seq Scan on rp0 rp_1 Filter: (a <> 1) - -> Seq Scan on rp1 rp_1 + -> Seq Scan on rp1 rp_2 Filter: (a <> 1) - -> Seq Scan on rp2 rp_2 + -> Seq Scan on rp2 rp_3 Filter: (a <> 1) (7 rows) @@ -1380,11 +1380,11 @@ explain (costs off) select * from rp where a <> 1 and a <> 2; QUERY PLAN ----------------------------------------- Append - -> Seq Scan on rp0 rp + -> Seq Scan on rp0 rp_1 Filter: ((a <> 1) AND (a <> 2)) - -> Seq Scan on rp1 rp_1 + -> Seq Scan on rp1 rp_2 Filter: ((a <> 1) AND (a <> 2)) - -> Seq Scan on rp2 rp_2 + -> Seq Scan on rp2 rp_3 Filter: ((a <> 1) AND (a <> 2)) (7 rows) @@ -1393,15 +1393,15 @@ explain (costs off) select * from lp where a <> 'a'; QUERY PLAN ------------------------------------ Append - -> Seq Scan on lp_ad lp + -> Seq Scan on lp_ad lp_1 Filter: (a <> 'a'::bpchar) - -> Seq Scan on lp_bc lp_1 + -> Seq Scan on lp_bc lp_2 Filter: (a <> 'a'::bpchar) - -> Seq Scan on lp_ef lp_2 + -> Seq Scan on lp_ef lp_3 Filter: (a <> 'a'::bpchar) - -> Seq Scan on lp_g lp_3 + -> Seq Scan on lp_g lp_4 Filter: (a <> 'a'::bpchar) - -> Seq Scan on lp_default lp_4 + -> Seq Scan on lp_default lp_5 Filter: (a <> 'a'::bpchar) (11 rows) @@ -1417,15 +1417,15 @@ explain (costs off) select * from lp where (a <> 'a' and a <> 'd') or a is null; QUERY PLAN ------------------------------------------------------------------------------ Append - -> Seq Scan on lp_bc lp + -> Seq Scan on lp_bc lp_1 Filter: (((a <> 'a'::bpchar) AND (a <> 'd'::bpchar)) OR (a IS NULL)) - -> Seq Scan on lp_ef lp_1 + -> Seq Scan on lp_ef lp_2 Filter: (((a <> 'a'::bpchar) AND (a <> 'd'::bpchar)) OR (a IS NULL)) - -> Seq Scan on lp_g lp_2 + -> Seq Scan on lp_g lp_3 Filter: (((a <> 'a'::bpchar) AND (a <> 'd'::bpchar)) OR (a IS NULL)) - -> Seq Scan on lp_null lp_3 + -> Seq Scan on lp_null lp_4 Filter: (((a <> 'a'::bpchar) AND (a <> 'd'::bpchar)) OR (a IS NULL)) - -> Seq Scan on lp_default lp_4 + -> Seq Scan on lp_default lp_5 Filter: (((a <> 'a'::bpchar) AND (a <> 'd'::bpchar)) OR (a IS NULL)) (11 rows) @@ -1436,9 +1436,9 @@ explain (costs off) select * from rlp where a = 15 and b <> 'ab' and b <> 'cd' a QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------ Append - -> Seq Scan on rlp3efgh rlp + -> Seq Scan on rlp3efgh rlp_1 Filter: ((b IS NOT NULL) AND ((b)::text <> 'ab'::text) AND ((b)::text <> 'cd'::text) AND ((b)::text <> 'xy'::text) AND (a = 15)) - -> Seq Scan on rlp3_default rlp_1 + -> Seq Scan on rlp3_default rlp_2 Filter: ((b IS NOT NULL) AND ((b)::text <> 'ab'::text) AND ((b)::text <> 'cd'::text) AND ((b)::text <> 'xy'::text) AND (a = 15)) (5 rows) @@ -1454,11 +1454,11 @@ explain (costs off) select * from coll_pruning_multi where substr(a, 1) = 'e' co QUERY PLAN ------------------------------------------------------------ Append - -> Seq Scan on coll_pruning_multi1 coll_pruning_multi + -> Seq Scan on coll_pruning_multi1 coll_pruning_multi_1 Filter: (substr(a, 1) = 'e'::text COLLATE "C") - -> Seq Scan on coll_pruning_multi2 coll_pruning_multi_1 + -> Seq Scan on coll_pruning_multi2 coll_pruning_multi_2 Filter: (substr(a, 1) = 'e'::text COLLATE "C") - -> Seq Scan on coll_pruning_multi3 coll_pruning_multi_2 + -> Seq Scan on coll_pruning_multi3 coll_pruning_multi_3 Filter: (substr(a, 1) = 'e'::text COLLATE "C") (7 rows) @@ -1467,9 +1467,9 @@ explain (costs off) select * from coll_pruning_multi where substr(a, 1) = 'a' co QUERY PLAN ------------------------------------------------------------ Append - -> Seq Scan on coll_pruning_multi1 coll_pruning_multi + -> Seq Scan on coll_pruning_multi1 coll_pruning_multi_1 Filter: (substr(a, 1) = 'a'::text COLLATE "POSIX") - -> Seq Scan on coll_pruning_multi2 coll_pruning_multi_1 + -> Seq Scan on coll_pruning_multi2 coll_pruning_multi_2 Filter: (substr(a, 1) = 'a'::text COLLATE "POSIX") (5 rows) @@ -1491,9 +1491,9 @@ explain (costs off) select * from like_op_noprune where a like '%BC'; QUERY PLAN ------------------------------------------------------ Append - -> Seq Scan on like_op_noprune1 like_op_noprune + -> Seq Scan on like_op_noprune1 like_op_noprune_1 Filter: (a ~~ '%BC'::text) - -> Seq Scan on like_op_noprune2 like_op_noprune_1 + -> Seq Scan on like_op_noprune2 like_op_noprune_2 Filter: (a ~~ '%BC'::text) (5 rows) @@ -1565,13 +1565,13 @@ explain (costs off) select * from hp where a = 1; QUERY PLAN ---------------------------- Append - -> Seq Scan on hp0 hp + -> Seq Scan on hp0 hp_1 Filter: (a = 1) - -> Seq Scan on hp1 hp_1 + -> Seq Scan on hp1 hp_2 Filter: (a = 1) - -> Seq Scan on hp2 hp_2 + -> Seq Scan on hp2 hp_3 Filter: (a = 1) - -> Seq Scan on hp3 hp_3 + -> Seq Scan on hp3 hp_4 Filter: (a = 1) (9 rows) @@ -1579,13 +1579,13 @@ explain (costs off) select * from hp where b = 'xxx'; QUERY PLAN ----------------------------------- Append - -> Seq Scan on hp0 hp + -> Seq Scan on hp0 hp_1 Filter: (b = 'xxx'::text) - -> Seq Scan on hp1 hp_1 + -> Seq Scan on hp1 hp_2 Filter: (b = 'xxx'::text) - -> Seq Scan on hp2 hp_2 + -> Seq Scan on hp2 hp_3 Filter: (b = 'xxx'::text) - -> Seq Scan on hp3 hp_3 + -> Seq Scan on hp3 hp_4 Filter: (b = 'xxx'::text) (9 rows) @@ -1593,13 +1593,13 @@ explain (costs off) select * from hp where a is null; QUERY PLAN ----------------------------- Append - -> Seq Scan on hp0 hp + -> Seq Scan on hp0 hp_1 Filter: (a IS NULL) - -> Seq Scan on hp1 hp_1 + -> Seq Scan on hp1 hp_2 Filter: (a IS NULL) - -> Seq Scan on hp2 hp_2 + -> Seq Scan on hp2 hp_3 Filter: (a IS NULL) - -> Seq Scan on hp3 hp_3 + -> Seq Scan on hp3 hp_4 Filter: (a IS NULL) (9 rows) @@ -1607,13 +1607,13 @@ explain (costs off) select * from hp where b is null; QUERY PLAN ----------------------------- Append - -> Seq Scan on hp0 hp + -> Seq Scan on hp0 hp_1 Filter: (b IS NULL) - -> Seq Scan on hp1 hp_1 + -> Seq Scan on hp1 hp_2 Filter: (b IS NULL) - -> Seq Scan on hp2 hp_2 + -> Seq Scan on hp2 hp_3 Filter: (b IS NULL) - -> Seq Scan on hp3 hp_3 + -> Seq Scan on hp3 hp_4 Filter: (b IS NULL) (9 rows) @@ -1621,13 +1621,13 @@ explain (costs off) select * from hp where a < 1 and b = 'xxx'; QUERY PLAN ------------------------------------------------- Append - -> Seq Scan on hp0 hp + -> Seq Scan on hp0 hp_1 Filter: ((a < 1) AND (b = 'xxx'::text)) - -> Seq Scan on hp1 hp_1 + -> Seq Scan on hp1 hp_2 Filter: ((a < 1) AND (b = 'xxx'::text)) - -> Seq Scan on hp2 hp_2 + -> Seq Scan on hp2 hp_3 Filter: ((a < 1) AND (b = 'xxx'::text)) - -> Seq Scan on hp3 hp_3 + -> Seq Scan on hp3 hp_4 Filter: ((a < 1) AND (b = 'xxx'::text)) (9 rows) @@ -1635,13 +1635,13 @@ explain (costs off) select * from hp where a <> 1 and b = 'yyy'; QUERY PLAN -------------------------------------------------- Append - -> Seq Scan on hp0 hp + -> Seq Scan on hp0 hp_1 Filter: ((a <> 1) AND (b = 'yyy'::text)) - -> Seq Scan on hp1 hp_1 + -> Seq Scan on hp1 hp_2 Filter: ((a <> 1) AND (b = 'yyy'::text)) - -> Seq Scan on hp2 hp_2 + -> Seq Scan on hp2 hp_3 Filter: ((a <> 1) AND (b = 'yyy'::text)) - -> Seq Scan on hp3 hp_3 + -> Seq Scan on hp3 hp_4 Filter: ((a <> 1) AND (b = 'yyy'::text)) (9 rows) @@ -1649,13 +1649,13 @@ explain (costs off) select * from hp where a <> 1 and b <> 'xxx'; QUERY PLAN --------------------------------------------------- Append - -> Seq Scan on hp0 hp + -> Seq Scan on hp0 hp_1 Filter: ((a <> 1) AND (b <> 'xxx'::text)) - -> Seq Scan on hp1 hp_1 + -> Seq Scan on hp1 hp_2 Filter: ((a <> 1) AND (b <> 'xxx'::text)) - -> Seq Scan on hp2 hp_2 + -> Seq Scan on hp2 hp_3 Filter: ((a <> 1) AND (b <> 'xxx'::text)) - -> Seq Scan on hp3 hp_3 + -> Seq Scan on hp3 hp_4 Filter: ((a <> 1) AND (b <> 'xxx'::text)) (9 rows) @@ -1707,11 +1707,11 @@ explain (costs off) select * from hp where (a = 1 and b = 'abcde') or (a = 2 and QUERY PLAN ------------------------------------------------------------------------------------------------------------------------- Append - -> Seq Scan on hp0 hp + -> Seq Scan on hp0 hp_1 Filter: (((a = 1) AND (b = 'abcde'::text)) OR ((a = 2) AND (b = 'xxx'::text)) OR ((a IS NULL) AND (b IS NULL))) - -> Seq Scan on hp2 hp_1 + -> Seq Scan on hp2 hp_2 Filter: (((a = 1) AND (b = 'abcde'::text)) OR ((a = 2) AND (b = 'xxx'::text)) OR ((a IS NULL) AND (b IS NULL))) - -> Seq Scan on hp3 hp_2 + -> Seq Scan on hp3 hp_3 Filter: (((a = 1) AND (b = 'abcde'::text)) OR ((a = 2) AND (b = 'xxx'::text)) OR ((a IS NULL) AND (b IS NULL))) (7 rows) @@ -1743,11 +1743,11 @@ explain (analyze, costs off, summary off, timing off) execute ab_q1 (2, 2, 3); --------------------------------------------------------- Append (actual rows=0 loops=1) Subplans Removed: 6 - -> Seq Scan on ab_a2_b1 ab (actual rows=0 loops=1) + -> Seq Scan on ab_a2_b1 ab_1 (actual rows=0 loops=1) Filter: ((a >= $1) AND (a <= $2) AND (b <= $3)) - -> Seq Scan on ab_a2_b2 ab_1 (actual rows=0 loops=1) + -> Seq Scan on ab_a2_b2 ab_2 (actual rows=0 loops=1) Filter: ((a >= $1) AND (a <= $2) AND (b <= $3)) - -> Seq Scan on ab_a2_b3 ab_2 (actual rows=0 loops=1) + -> Seq Scan on ab_a2_b3 ab_3 (actual rows=0 loops=1) Filter: ((a >= $1) AND (a <= $2) AND (b <= $3)) (8 rows) @@ -1756,17 +1756,17 @@ explain (analyze, costs off, summary off, timing off) execute ab_q1 (1, 2, 3); --------------------------------------------------------- Append (actual rows=0 loops=1) Subplans Removed: 3 - -> Seq Scan on ab_a1_b1 ab (actual rows=0 loops=1) + -> Seq Scan on ab_a1_b1 ab_1 (actual rows=0 loops=1) Filter: ((a >= $1) AND (a <= $2) AND (b <= $3)) - -> Seq Scan on ab_a1_b2 ab_1 (actual rows=0 loops=1) + -> Seq Scan on ab_a1_b2 ab_2 (actual rows=0 loops=1) Filter: ((a >= $1) AND (a <= $2) AND (b <= $3)) - -> Seq Scan on ab_a1_b3 ab_2 (actual rows=0 loops=1) + -> Seq Scan on ab_a1_b3 ab_3 (actual rows=0 loops=1) Filter: ((a >= $1) AND (a <= $2) AND (b <= $3)) - -> Seq Scan on ab_a2_b1 ab_3 (actual rows=0 loops=1) + -> Seq Scan on ab_a2_b1 ab_4 (actual rows=0 loops=1) Filter: ((a >= $1) AND (a <= $2) AND (b <= $3)) - -> Seq Scan on ab_a2_b2 ab_4 (actual rows=0 loops=1) + -> Seq Scan on ab_a2_b2 ab_5 (actual rows=0 loops=1) Filter: ((a >= $1) AND (a <= $2) AND (b <= $3)) - -> Seq Scan on ab_a2_b3 ab_5 (actual rows=0 loops=1) + -> Seq Scan on ab_a2_b3 ab_6 (actual rows=0 loops=1) Filter: ((a >= $1) AND (a <= $2) AND (b <= $3)) (14 rows) @@ -1779,9 +1779,9 @@ explain (analyze, costs off, summary off, timing off) execute ab_q1 (2, 2); --------------------------------------------------------- Append (actual rows=0 loops=1) Subplans Removed: 4 - -> Seq Scan on ab_a2_b1 ab (actual rows=0 loops=1) + -> Seq Scan on ab_a2_b1 ab_1 (actual rows=0 loops=1) Filter: ((a >= $1) AND (a <= $2) AND (b < 3)) - -> Seq Scan on ab_a2_b2 ab_1 (actual rows=0 loops=1) + -> Seq Scan on ab_a2_b2 ab_2 (actual rows=0 loops=1) Filter: ((a >= $1) AND (a <= $2) AND (b < 3)) (6 rows) @@ -1790,13 +1790,13 @@ explain (analyze, costs off, summary off, timing off) execute ab_q1 (2, 4); --------------------------------------------------------- Append (actual rows=0 loops=1) Subplans Removed: 2 - -> Seq Scan on ab_a2_b1 ab (actual rows=0 loops=1) + -> Seq Scan on ab_a2_b1 ab_1 (actual rows=0 loops=1) Filter: ((a >= $1) AND (a <= $2) AND (b < 3)) - -> Seq Scan on ab_a2_b2 ab_1 (actual rows=0 loops=1) + -> Seq Scan on ab_a2_b2 ab_2 (actual rows=0 loops=1) Filter: ((a >= $1) AND (a <= $2) AND (b < 3)) - -> Seq Scan on ab_a3_b1 ab_2 (actual rows=0 loops=1) + -> Seq Scan on ab_a3_b1 ab_3 (actual rows=0 loops=1) Filter: ((a >= $1) AND (a <= $2) AND (b < 3)) - -> Seq Scan on ab_a3_b2 ab_3 (actual rows=0 loops=1) + -> Seq Scan on ab_a3_b2 ab_4 (actual rows=0 loops=1) Filter: ((a >= $1) AND (a <= $2) AND (b < 3)) (10 rows) @@ -1811,11 +1811,11 @@ explain (analyze, costs off, summary off, timing off) execute ab_q2 (2, 2); InitPlan 1 (returns $0) -> Result (actual rows=1 loops=1) Subplans Removed: 6 - -> Seq Scan on ab_a2_b1 ab (actual rows=0 loops=1) + -> Seq Scan on ab_a2_b1 ab_1 (actual rows=0 loops=1) Filter: ((a >= $1) AND (a <= $2) AND (b < $0)) - -> Seq Scan on ab_a2_b2 ab_1 (actual rows=0 loops=1) + -> Seq Scan on ab_a2_b2 ab_2 (actual rows=0 loops=1) Filter: ((a >= $1) AND (a <= $2) AND (b < $0)) - -> Seq Scan on ab_a2_b3 ab_2 (never executed) + -> Seq Scan on ab_a2_b3 ab_3 (never executed) Filter: ((a >= $1) AND (a <= $2) AND (b < $0)) (10 rows) @@ -1829,11 +1829,11 @@ explain (analyze, costs off, summary off, timing off) execute ab_q3 (2, 2); InitPlan 1 (returns $0) -> Result (actual rows=1 loops=1) Subplans Removed: 6 - -> Seq Scan on ab_a1_b2 ab (actual rows=0 loops=1) + -> Seq Scan on ab_a1_b2 ab_1 (actual rows=0 loops=1) Filter: ((b >= $1) AND (b <= $2) AND (a < $0)) - -> Seq Scan on ab_a2_b2 ab_1 (actual rows=0 loops=1) + -> Seq Scan on ab_a2_b2 ab_2 (actual rows=0 loops=1) Filter: ((b >= $1) AND (b <= $2) AND (a < $0)) - -> Seq Scan on ab_a3_b2 ab_2 (never executed) + -> Seq Scan on ab_a3_b2 ab_3 (never executed) Filter: ((b >= $1) AND (b <= $2) AND (a < $0)) (10 rows) @@ -1864,11 +1864,11 @@ begin; create function list_part_fn(int) returns int as $$ begin return $1; end;$$ language plpgsql stable; -- Ensure pruning works using a stable function containing no Vars explain (analyze, costs off, summary off, timing off) select * from list_part where a = list_part_fn(1); - QUERY PLAN ----------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------ Append (actual rows=1 loops=1) Subplans Removed: 3 - -> Seq Scan on list_part1 list_part (actual rows=1 loops=1) + -> Seq Scan on list_part1 list_part_1 (actual rows=1 loops=1) Filter: (a = list_part_fn(1)) (4 rows) @@ -1877,13 +1877,13 @@ explain (analyze, costs off, summary off, timing off) select * from list_part wh QUERY PLAN ------------------------------------------------------------------ Append (actual rows=4 loops=1) - -> Seq Scan on list_part1 list_part (actual rows=1 loops=1) + -> Seq Scan on list_part1 list_part_1 (actual rows=1 loops=1) Filter: (a = list_part_fn(a)) - -> Seq Scan on list_part2 list_part_1 (actual rows=1 loops=1) + -> Seq Scan on list_part2 list_part_2 (actual rows=1 loops=1) Filter: (a = list_part_fn(a)) - -> Seq Scan on list_part3 list_part_2 (actual rows=1 loops=1) + -> Seq Scan on list_part3 list_part_3 (actual rows=1 loops=1) Filter: (a = list_part_fn(a)) - -> Seq Scan on list_part4 list_part_3 (actual rows=1 loops=1) + -> Seq Scan on list_part4 list_part_4 (actual rows=1 loops=1) Filter: (a = list_part_fn(a)) (9 rows) @@ -1892,16 +1892,16 @@ explain (analyze, costs off, summary off, timing off) select * from list_part wh QUERY PLAN ------------------------------------------------------------------ Append (actual rows=0 loops=1) - -> Seq Scan on list_part1 list_part (actual rows=0 loops=1) + -> Seq Scan on list_part1 list_part_1 (actual rows=0 loops=1) Filter: (a = (list_part_fn(1) + a)) Rows Removed by Filter: 1 - -> Seq Scan on list_part2 list_part_1 (actual rows=0 loops=1) + -> Seq Scan on list_part2 list_part_2 (actual rows=0 loops=1) Filter: (a = (list_part_fn(1) + a)) Rows Removed by Filter: 1 - -> Seq Scan on list_part3 list_part_2 (actual rows=0 loops=1) + -> Seq Scan on list_part3 list_part_3 (actual rows=0 loops=1) Filter: (a = (list_part_fn(1) + a)) Rows Removed by Filter: 1 - -> Seq Scan on list_part4 list_part_3 (actual rows=0 loops=1) + -> Seq Scan on list_part4 list_part_4 (actual rows=0 loops=1) Filter: (a = (list_part_fn(1) + a)) Rows Removed by Filter: 1 (13 rows) @@ -1951,11 +1951,11 @@ select explain_parallel_append('execute ab_q4 (2, 2)'); -> Partial Aggregate (actual rows=N loops=N) -> Parallel Append (actual rows=N loops=N) Subplans Removed: 6 - -> Parallel Seq Scan on ab_a2_b1 ab (actual rows=N loops=N) + -> Parallel Seq Scan on ab_a2_b1 ab_1 (actual rows=N loops=N) Filter: ((a >= $1) AND (a <= $2) AND (b < 4)) - -> Parallel Seq Scan on ab_a2_b2 ab_1 (actual rows=N loops=N) + -> Parallel Seq Scan on ab_a2_b2 ab_2 (actual rows=N loops=N) Filter: ((a >= $1) AND (a <= $2) AND (b < 4)) - -> Parallel Seq Scan on ab_a2_b3 ab_2 (actual rows=N loops=N) + -> Parallel Seq Scan on ab_a2_b3 ab_3 (actual rows=N loops=N) Filter: ((a >= $1) AND (a <= $2) AND (b < 4)) (13 rows) @@ -1972,11 +1972,11 @@ select explain_parallel_append('execute ab_q5 (1, 1, 1)'); -> Partial Aggregate (actual rows=N loops=N) -> Parallel Append (actual rows=N loops=N) Subplans Removed: 6 - -> Parallel Seq Scan on ab_a1_b1 ab (actual rows=N loops=N) + -> Parallel Seq Scan on ab_a1_b1 ab_1 (actual rows=N loops=N) Filter: ((b < 4) AND (a = ANY (ARRAY[$1, $2, $3]))) - -> Parallel Seq Scan on ab_a1_b2 ab_1 (actual rows=N loops=N) + -> Parallel Seq Scan on ab_a1_b2 ab_2 (actual rows=N loops=N) Filter: ((b < 4) AND (a = ANY (ARRAY[$1, $2, $3]))) - -> Parallel Seq Scan on ab_a1_b3 ab_2 (actual rows=N loops=N) + -> Parallel Seq Scan on ab_a1_b3 ab_3 (actual rows=N loops=N) Filter: ((b < 4) AND (a = ANY (ARRAY[$1, $2, $3]))) (13 rows) @@ -1990,17 +1990,17 @@ select explain_parallel_append('execute ab_q5 (2, 3, 3)'); -> Partial Aggregate (actual rows=N loops=N) -> Parallel Append (actual rows=N loops=N) Subplans Removed: 3 - -> Parallel Seq Scan on ab_a2_b1 ab (actual rows=N loops=N) + -> Parallel Seq Scan on ab_a2_b1 ab_1 (actual rows=N loops=N) Filter: ((b < 4) AND (a = ANY (ARRAY[$1, $2, $3]))) - -> Parallel Seq Scan on ab_a2_b2 ab_1 (actual rows=N loops=N) + -> Parallel Seq Scan on ab_a2_b2 ab_2 (actual rows=N loops=N) Filter: ((b < 4) AND (a = ANY (ARRAY[$1, $2, $3]))) - -> Parallel Seq Scan on ab_a2_b3 ab_2 (actual rows=N loops=N) + -> Parallel Seq Scan on ab_a2_b3 ab_3 (actual rows=N loops=N) Filter: ((b < 4) AND (a = ANY (ARRAY[$1, $2, $3]))) - -> Parallel Seq Scan on ab_a3_b1 ab_3 (actual rows=N loops=N) + -> Parallel Seq Scan on ab_a3_b1 ab_4 (actual rows=N loops=N) Filter: ((b < 4) AND (a = ANY (ARRAY[$1, $2, $3]))) - -> Parallel Seq Scan on ab_a3_b2 ab_4 (actual rows=N loops=N) + -> Parallel Seq Scan on ab_a3_b2 ab_5 (actual rows=N loops=N) Filter: ((b < 4) AND (a = ANY (ARRAY[$1, $2, $3]))) - -> Parallel Seq Scan on ab_a3_b3 ab_5 (actual rows=N loops=N) + -> Parallel Seq Scan on ab_a3_b3 ab_6 (actual rows=N loops=N) Filter: ((b < 4) AND (a = ANY (ARRAY[$1, $2, $3]))) (19 rows) @@ -2016,7 +2016,7 @@ select explain_parallel_append('execute ab_q5 (33, 44, 55)'); -> Partial Aggregate (actual rows=N loops=N) -> Parallel Append (actual rows=N loops=N) Subplans Removed: 8 - -> Parallel Seq Scan on ab_a1_b1 ab (never executed) + -> Parallel Seq Scan on ab_a1_b1 ab_1 (never executed) Filter: ((b < 4) AND (a = ANY (ARRAY[$1, $2, $3]))) (9 rows) @@ -2034,11 +2034,11 @@ select explain_parallel_append('select count(*) from ab where (a = (select 1) or Params Evaluated: $0, $1 Workers Launched: N -> Parallel Append (actual rows=N loops=N) - -> Parallel Seq Scan on ab_a1_b2 ab (actual rows=N loops=N) + -> Parallel Seq Scan on ab_a1_b2 ab_1 (actual rows=N loops=N) Filter: ((b = 2) AND ((a = $0) OR (a = $1))) - -> Parallel Seq Scan on ab_a2_b2 ab_1 (never executed) + -> Parallel Seq Scan on ab_a2_b2 ab_2 (never executed) Filter: ((b = 2) AND ((a = $0) OR (a = $1))) - -> Parallel Seq Scan on ab_a3_b2 ab_2 (actual rows=N loops=N) + -> Parallel Seq Scan on ab_a3_b2 ab_3 (actual rows=N loops=N) Filter: ((b = 2) AND ((a = $0) OR (a = $1))) (16 rows) @@ -2072,23 +2072,23 @@ select explain_parallel_append('select avg(ab.a) from ab inner join lprt_a a on -> Parallel Seq Scan on lprt_a a (actual rows=N loops=N) Filter: (a = ANY ('{0,0,1}'::integer[])) -> Append (actual rows=N loops=N) - -> Index Scan using ab_a1_b1_a_idx on ab_a1_b1 ab (actual rows=N loops=N) + -> Index Scan using ab_a1_b1_a_idx on ab_a1_b1 ab_1 (actual rows=N loops=N) Index Cond: (a = a.a) - -> Index Scan using ab_a1_b2_a_idx on ab_a1_b2 ab_1 (actual rows=N loops=N) + -> Index Scan using ab_a1_b2_a_idx on ab_a1_b2 ab_2 (actual rows=N loops=N) Index Cond: (a = a.a) - -> Index Scan using ab_a1_b3_a_idx on ab_a1_b3 ab_2 (actual rows=N loops=N) + -> Index Scan using ab_a1_b3_a_idx on ab_a1_b3 ab_3 (actual rows=N loops=N) Index Cond: (a = a.a) - -> Index Scan using ab_a2_b1_a_idx on ab_a2_b1 ab_3 (never executed) + -> Index Scan using ab_a2_b1_a_idx on ab_a2_b1 ab_4 (never executed) Index Cond: (a = a.a) - -> Index Scan using ab_a2_b2_a_idx on ab_a2_b2 ab_4 (never executed) + -> Index Scan using ab_a2_b2_a_idx on ab_a2_b2 ab_5 (never executed) Index Cond: (a = a.a) - -> Index Scan using ab_a2_b3_a_idx on ab_a2_b3 ab_5 (never executed) + -> Index Scan using ab_a2_b3_a_idx on ab_a2_b3 ab_6 (never executed) Index Cond: (a = a.a) - -> Index Scan using ab_a3_b1_a_idx on ab_a3_b1 ab_6 (never executed) + -> Index Scan using ab_a3_b1_a_idx on ab_a3_b1 ab_7 (never executed) Index Cond: (a = a.a) - -> Index Scan using ab_a3_b2_a_idx on ab_a3_b2 ab_7 (never executed) + -> Index Scan using ab_a3_b2_a_idx on ab_a3_b2 ab_8 (never executed) Index Cond: (a = a.a) - -> Index Scan using ab_a3_b3_a_idx on ab_a3_b3 ab_8 (never executed) + -> Index Scan using ab_a3_b3_a_idx on ab_a3_b3 ab_9 (never executed) Index Cond: (a = a.a) (27 rows) @@ -2106,23 +2106,23 @@ select explain_parallel_append('select avg(ab.a) from ab inner join lprt_a a on -> Parallel Seq Scan on lprt_a a (actual rows=N loops=N) Filter: (a = ANY ('{0,0,1}'::integer[])) -> Append (actual rows=N loops=N) - -> Index Scan using ab_a1_b1_a_idx on ab_a1_b1 ab (actual rows=N loops=N) + -> Index Scan using ab_a1_b1_a_idx on ab_a1_b1 ab_1 (actual rows=N loops=N) Index Cond: (a = (a.a + 0)) - -> Index Scan using ab_a1_b2_a_idx on ab_a1_b2 ab_1 (actual rows=N loops=N) + -> Index Scan using ab_a1_b2_a_idx on ab_a1_b2 ab_2 (actual rows=N loops=N) Index Cond: (a = (a.a + 0)) - -> Index Scan using ab_a1_b3_a_idx on ab_a1_b3 ab_2 (actual rows=N loops=N) + -> Index Scan using ab_a1_b3_a_idx on ab_a1_b3 ab_3 (actual rows=N loops=N) Index Cond: (a = (a.a + 0)) - -> Index Scan using ab_a2_b1_a_idx on ab_a2_b1 ab_3 (never executed) + -> Index Scan using ab_a2_b1_a_idx on ab_a2_b1 ab_4 (never executed) Index Cond: (a = (a.a + 0)) - -> Index Scan using ab_a2_b2_a_idx on ab_a2_b2 ab_4 (never executed) + -> Index Scan using ab_a2_b2_a_idx on ab_a2_b2 ab_5 (never executed) Index Cond: (a = (a.a + 0)) - -> Index Scan using ab_a2_b3_a_idx on ab_a2_b3 ab_5 (never executed) + -> Index Scan using ab_a2_b3_a_idx on ab_a2_b3 ab_6 (never executed) Index Cond: (a = (a.a + 0)) - -> Index Scan using ab_a3_b1_a_idx on ab_a3_b1 ab_6 (never executed) + -> Index Scan using ab_a3_b1_a_idx on ab_a3_b1 ab_7 (never executed) Index Cond: (a = (a.a + 0)) - -> Index Scan using ab_a3_b2_a_idx on ab_a3_b2 ab_7 (never executed) + -> Index Scan using ab_a3_b2_a_idx on ab_a3_b2 ab_8 (never executed) Index Cond: (a = (a.a + 0)) - -> Index Scan using ab_a3_b3_a_idx on ab_a3_b3 ab_8 (never executed) + -> Index Scan using ab_a3_b3_a_idx on ab_a3_b3 ab_9 (never executed) Index Cond: (a = (a.a + 0)) (27 rows) @@ -2139,23 +2139,23 @@ select explain_parallel_append('select avg(ab.a) from ab inner join lprt_a a on -> Parallel Seq Scan on lprt_a a (actual rows=N loops=N) Filter: (a = ANY ('{1,0,3}'::integer[])) -> Append (actual rows=N loops=N) - -> Index Scan using ab_a1_b1_a_idx on ab_a1_b1 ab (actual rows=N loops=N) + -> Index Scan using ab_a1_b1_a_idx on ab_a1_b1 ab_1 (actual rows=N loops=N) Index Cond: (a = a.a) - -> Index Scan using ab_a1_b2_a_idx on ab_a1_b2 ab_1 (actual rows=N loops=N) + -> Index Scan using ab_a1_b2_a_idx on ab_a1_b2 ab_2 (actual rows=N loops=N) Index Cond: (a = a.a) - -> Index Scan using ab_a1_b3_a_idx on ab_a1_b3 ab_2 (actual rows=N loops=N) + -> Index Scan using ab_a1_b3_a_idx on ab_a1_b3 ab_3 (actual rows=N loops=N) Index Cond: (a = a.a) - -> Index Scan using ab_a2_b1_a_idx on ab_a2_b1 ab_3 (never executed) + -> Index Scan using ab_a2_b1_a_idx on ab_a2_b1 ab_4 (never executed) Index Cond: (a = a.a) - -> Index Scan using ab_a2_b2_a_idx on ab_a2_b2 ab_4 (never executed) + -> Index Scan using ab_a2_b2_a_idx on ab_a2_b2 ab_5 (never executed) Index Cond: (a = a.a) - -> Index Scan using ab_a2_b3_a_idx on ab_a2_b3 ab_5 (never executed) + -> Index Scan using ab_a2_b3_a_idx on ab_a2_b3 ab_6 (never executed) Index Cond: (a = a.a) - -> Index Scan using ab_a3_b1_a_idx on ab_a3_b1 ab_6 (actual rows=N loops=N) + -> Index Scan using ab_a3_b1_a_idx on ab_a3_b1 ab_7 (actual rows=N loops=N) Index Cond: (a = a.a) - -> Index Scan using ab_a3_b2_a_idx on ab_a3_b2 ab_7 (actual rows=N loops=N) + -> Index Scan using ab_a3_b2_a_idx on ab_a3_b2 ab_8 (actual rows=N loops=N) Index Cond: (a = a.a) - -> Index Scan using ab_a3_b3_a_idx on ab_a3_b3 ab_8 (actual rows=N loops=N) + -> Index Scan using ab_a3_b3_a_idx on ab_a3_b3 ab_9 (actual rows=N loops=N) Index Cond: (a = a.a) (27 rows) @@ -2172,23 +2172,23 @@ select explain_parallel_append('select avg(ab.a) from ab inner join lprt_a a on Filter: (a = ANY ('{1,0,0}'::integer[])) Rows Removed by Filter: N -> Append (actual rows=N loops=N) - -> Index Scan using ab_a1_b1_a_idx on ab_a1_b1 ab (actual rows=N loops=N) + -> Index Scan using ab_a1_b1_a_idx on ab_a1_b1 ab_1 (actual rows=N loops=N) Index Cond: (a = a.a) - -> Index Scan using ab_a1_b2_a_idx on ab_a1_b2 ab_1 (actual rows=N loops=N) + -> Index Scan using ab_a1_b2_a_idx on ab_a1_b2 ab_2 (actual rows=N loops=N) Index Cond: (a = a.a) - -> Index Scan using ab_a1_b3_a_idx on ab_a1_b3 ab_2 (actual rows=N loops=N) + -> Index Scan using ab_a1_b3_a_idx on ab_a1_b3 ab_3 (actual rows=N loops=N) Index Cond: (a = a.a) - -> Index Scan using ab_a2_b1_a_idx on ab_a2_b1 ab_3 (never executed) + -> Index Scan using ab_a2_b1_a_idx on ab_a2_b1 ab_4 (never executed) Index Cond: (a = a.a) - -> Index Scan using ab_a2_b2_a_idx on ab_a2_b2 ab_4 (never executed) + -> Index Scan using ab_a2_b2_a_idx on ab_a2_b2 ab_5 (never executed) Index Cond: (a = a.a) - -> Index Scan using ab_a2_b3_a_idx on ab_a2_b3 ab_5 (never executed) + -> Index Scan using ab_a2_b3_a_idx on ab_a2_b3 ab_6 (never executed) Index Cond: (a = a.a) - -> Index Scan using ab_a3_b1_a_idx on ab_a3_b1 ab_6 (never executed) + -> Index Scan using ab_a3_b1_a_idx on ab_a3_b1 ab_7 (never executed) Index Cond: (a = a.a) - -> Index Scan using ab_a3_b2_a_idx on ab_a3_b2 ab_7 (never executed) + -> Index Scan using ab_a3_b2_a_idx on ab_a3_b2 ab_8 (never executed) Index Cond: (a = a.a) - -> Index Scan using ab_a3_b3_a_idx on ab_a3_b3 ab_8 (never executed) + -> Index Scan using ab_a3_b3_a_idx on ab_a3_b3 ab_9 (never executed) Index Cond: (a = a.a) (28 rows) @@ -2206,23 +2206,23 @@ select explain_parallel_append('select avg(ab.a) from ab inner join lprt_a a on Filter: (a = ANY ('{1,0,0}'::integer[])) Rows Removed by Filter: N -> Append (actual rows=N loops=N) - -> Index Scan using ab_a1_b1_a_idx on ab_a1_b1 ab (never executed) + -> Index Scan using ab_a1_b1_a_idx on ab_a1_b1 ab_1 (never executed) Index Cond: (a = a.a) - -> Index Scan using ab_a1_b2_a_idx on ab_a1_b2 ab_1 (never executed) + -> Index Scan using ab_a1_b2_a_idx on ab_a1_b2 ab_2 (never executed) Index Cond: (a = a.a) - -> Index Scan using ab_a1_b3_a_idx on ab_a1_b3 ab_2 (never executed) + -> Index Scan using ab_a1_b3_a_idx on ab_a1_b3 ab_3 (never executed) Index Cond: (a = a.a) - -> Index Scan using ab_a2_b1_a_idx on ab_a2_b1 ab_3 (never executed) + -> Index Scan using ab_a2_b1_a_idx on ab_a2_b1 ab_4 (never executed) Index Cond: (a = a.a) - -> Index Scan using ab_a2_b2_a_idx on ab_a2_b2 ab_4 (never executed) + -> Index Scan using ab_a2_b2_a_idx on ab_a2_b2 ab_5 (never executed) Index Cond: (a = a.a) - -> Index Scan using ab_a2_b3_a_idx on ab_a2_b3 ab_5 (never executed) + -> Index Scan using ab_a2_b3_a_idx on ab_a2_b3 ab_6 (never executed) Index Cond: (a = a.a) - -> Index Scan using ab_a3_b1_a_idx on ab_a3_b1 ab_6 (never executed) + -> Index Scan using ab_a3_b1_a_idx on ab_a3_b1 ab_7 (never executed) Index Cond: (a = a.a) - -> Index Scan using ab_a3_b2_a_idx on ab_a3_b2 ab_7 (never executed) + -> Index Scan using ab_a3_b2_a_idx on ab_a3_b2 ab_8 (never executed) Index Cond: (a = a.a) - -> Index Scan using ab_a3_b3_a_idx on ab_a3_b3 ab_8 (never executed) + -> Index Scan using ab_a3_b3_a_idx on ab_a3_b3 ab_9 (never executed) Index Cond: (a = a.a) (28 rows) @@ -2244,47 +2244,47 @@ select * from ab where a = (select max(a) from lprt_a) and b = (select max(a)-1 InitPlan 2 (returns $1) -> Aggregate (actual rows=1 loops=1) -> Seq Scan on lprt_a lprt_a_1 (actual rows=102 loops=1) - -> Bitmap Heap Scan on ab_a1_b1 ab (never executed) + -> Bitmap Heap Scan on ab_a1_b1 ab_1 (never executed) Recheck Cond: (a = $0) Filter: (b = $1) -> Bitmap Index Scan on ab_a1_b1_a_idx (never executed) Index Cond: (a = $0) - -> Bitmap Heap Scan on ab_a1_b2 ab_1 (never executed) + -> Bitmap Heap Scan on ab_a1_b2 ab_2 (never executed) Recheck Cond: (a = $0) Filter: (b = $1) -> Bitmap Index Scan on ab_a1_b2_a_idx (never executed) Index Cond: (a = $0) - -> Bitmap Heap Scan on ab_a1_b3 ab_2 (never executed) + -> Bitmap Heap Scan on ab_a1_b3 ab_3 (never executed) Recheck Cond: (a = $0) Filter: (b = $1) -> Bitmap Index Scan on ab_a1_b3_a_idx (never executed) Index Cond: (a = $0) - -> Bitmap Heap Scan on ab_a2_b1 ab_3 (never executed) + -> Bitmap Heap Scan on ab_a2_b1 ab_4 (never executed) Recheck Cond: (a = $0) Filter: (b = $1) -> Bitmap Index Scan on ab_a2_b1_a_idx (never executed) Index Cond: (a = $0) - -> Bitmap Heap Scan on ab_a2_b2 ab_4 (never executed) + -> Bitmap Heap Scan on ab_a2_b2 ab_5 (never executed) Recheck Cond: (a = $0) Filter: (b = $1) -> Bitmap Index Scan on ab_a2_b2_a_idx (never executed) Index Cond: (a = $0) - -> Bitmap Heap Scan on ab_a2_b3 ab_5 (never executed) + -> Bitmap Heap Scan on ab_a2_b3 ab_6 (never executed) Recheck Cond: (a = $0) Filter: (b = $1) -> Bitmap Index Scan on ab_a2_b3_a_idx (never executed) Index Cond: (a = $0) - -> Bitmap Heap Scan on ab_a3_b1 ab_6 (never executed) + -> Bitmap Heap Scan on ab_a3_b1 ab_7 (never executed) Recheck Cond: (a = $0) Filter: (b = $1) -> Bitmap Index Scan on ab_a3_b1_a_idx (never executed) Index Cond: (a = $0) - -> Bitmap Heap Scan on ab_a3_b2 ab_7 (actual rows=0 loops=1) + -> Bitmap Heap Scan on ab_a3_b2 ab_8 (actual rows=0 loops=1) Recheck Cond: (a = $0) Filter: (b = $1) -> Bitmap Index Scan on ab_a3_b2_a_idx (actual rows=0 loops=1) Index Cond: (a = $0) - -> Bitmap Heap Scan on ab_a3_b3 ab_8 (never executed) + -> Bitmap Heap Scan on ab_a3_b3 ab_9 (never executed) Recheck Cond: (a = $0) Filter: (b = $1) -> Bitmap Index Scan on ab_a3_b3_a_idx (never executed) @@ -2300,38 +2300,38 @@ select * from (select * from ab where a = 1 union all select * from ab) ab where InitPlan 1 (returns $0) -> Result (actual rows=1 loops=1) -> Append (actual rows=0 loops=1) - -> Bitmap Heap Scan on ab_a1_b1 ab_9 (actual rows=0 loops=1) + -> Bitmap Heap Scan on ab_a1_b1 ab_11 (actual rows=0 loops=1) Recheck Cond: (a = 1) Filter: (b = $0) -> Bitmap Index Scan on ab_a1_b1_a_idx (actual rows=0 loops=1) Index Cond: (a = 1) - -> Bitmap Heap Scan on ab_a1_b2 ab_10 (never executed) + -> Bitmap Heap Scan on ab_a1_b2 ab_12 (never executed) Recheck Cond: (a = 1) Filter: (b = $0) -> Bitmap Index Scan on ab_a1_b2_a_idx (never executed) Index Cond: (a = 1) - -> Bitmap Heap Scan on ab_a1_b3 ab_11 (never executed) + -> Bitmap Heap Scan on ab_a1_b3 ab_13 (never executed) Recheck Cond: (a = 1) Filter: (b = $0) -> Bitmap Index Scan on ab_a1_b3_a_idx (never executed) Index Cond: (a = 1) - -> Seq Scan on ab_a1_b1 ab (actual rows=0 loops=1) + -> Seq Scan on ab_a1_b1 ab_1 (actual rows=0 loops=1) Filter: (b = $0) - -> Seq Scan on ab_a1_b2 ab_1 (never executed) + -> Seq Scan on ab_a1_b2 ab_2 (never executed) Filter: (b = $0) - -> Seq Scan on ab_a1_b3 ab_2 (never executed) + -> Seq Scan on ab_a1_b3 ab_3 (never executed) Filter: (b = $0) - -> Seq Scan on ab_a2_b1 ab_3 (actual rows=0 loops=1) + -> Seq Scan on ab_a2_b1 ab_4 (actual rows=0 loops=1) Filter: (b = $0) - -> Seq Scan on ab_a2_b2 ab_4 (never executed) + -> Seq Scan on ab_a2_b2 ab_5 (never executed) Filter: (b = $0) - -> Seq Scan on ab_a2_b3 ab_5 (never executed) + -> Seq Scan on ab_a2_b3 ab_6 (never executed) Filter: (b = $0) - -> Seq Scan on ab_a3_b1 ab_6 (actual rows=0 loops=1) + -> Seq Scan on ab_a3_b1 ab_7 (actual rows=0 loops=1) Filter: (b = $0) - -> Seq Scan on ab_a3_b2 ab_7 (never executed) + -> Seq Scan on ab_a3_b2 ab_8 (never executed) Filter: (b = $0) - -> Seq Scan on ab_a3_b3 ab_8 (never executed) + -> Seq Scan on ab_a3_b3 ab_9 (never executed) Filter: (b = $0) (37 rows) @@ -2344,40 +2344,40 @@ select * from (select * from ab where a = 1 union all (values(10,5)) union all s InitPlan 1 (returns $0) -> Result (actual rows=1 loops=1) -> Append (actual rows=0 loops=1) - -> Bitmap Heap Scan on ab_a1_b1 ab_9 (actual rows=0 loops=1) + -> Bitmap Heap Scan on ab_a1_b1 ab_11 (actual rows=0 loops=1) Recheck Cond: (a = 1) Filter: (b = $0) -> Bitmap Index Scan on ab_a1_b1_a_idx (actual rows=0 loops=1) Index Cond: (a = 1) - -> Bitmap Heap Scan on ab_a1_b2 ab_10 (never executed) + -> Bitmap Heap Scan on ab_a1_b2 ab_12 (never executed) Recheck Cond: (a = 1) Filter: (b = $0) -> Bitmap Index Scan on ab_a1_b2_a_idx (never executed) Index Cond: (a = 1) - -> Bitmap Heap Scan on ab_a1_b3 ab_11 (never executed) + -> Bitmap Heap Scan on ab_a1_b3 ab_13 (never executed) Recheck Cond: (a = 1) Filter: (b = $0) -> Bitmap Index Scan on ab_a1_b3_a_idx (never executed) Index Cond: (a = 1) -> Result (actual rows=0 loops=1) One-Time Filter: (5 = $0) - -> Seq Scan on ab_a1_b1 ab (actual rows=0 loops=1) + -> Seq Scan on ab_a1_b1 ab_1 (actual rows=0 loops=1) Filter: (b = $0) - -> Seq Scan on ab_a1_b2 ab_1 (never executed) + -> Seq Scan on ab_a1_b2 ab_2 (never executed) Filter: (b = $0) - -> Seq Scan on ab_a1_b3 ab_2 (never executed) + -> Seq Scan on ab_a1_b3 ab_3 (never executed) Filter: (b = $0) - -> Seq Scan on ab_a2_b1 ab_3 (actual rows=0 loops=1) + -> Seq Scan on ab_a2_b1 ab_4 (actual rows=0 loops=1) Filter: (b = $0) - -> Seq Scan on ab_a2_b2 ab_4 (never executed) + -> Seq Scan on ab_a2_b2 ab_5 (never executed) Filter: (b = $0) - -> Seq Scan on ab_a2_b3 ab_5 (never executed) + -> Seq Scan on ab_a2_b3 ab_6 (never executed) Filter: (b = $0) - -> Seq Scan on ab_a3_b1 ab_6 (actual rows=0 loops=1) + -> Seq Scan on ab_a3_b1 ab_7 (actual rows=0 loops=1) Filter: (b = $0) - -> Seq Scan on ab_a3_b2 ab_7 (never executed) + -> Seq Scan on ab_a3_b2 ab_8 (never executed) Filter: (b = $0) - -> Seq Scan on ab_a3_b3 ab_8 (never executed) + -> Seq Scan on ab_a3_b3 ab_9 (never executed) Filter: (b = $0) (39 rows) @@ -2402,20 +2402,20 @@ explain (analyze, costs off, summary off, timing off) execute ab_q6(1); InitPlan 1 (returns $0) -> Result (actual rows=1 loops=1) Subplans Removed: 12 - -> Seq Scan on ab_a1_b1 ab (never executed) + -> Seq Scan on ab_a1_b1 ab_1 (never executed) Filter: ((a = $1) AND (b = $0)) - -> Seq Scan on ab_a1_b2 ab_1 (never executed) + -> Seq Scan on ab_a1_b2 ab_2 (never executed) Filter: ((a = $1) AND (b = $0)) - -> Seq Scan on ab_a1_b3 ab_2 (never executed) + -> Seq Scan on ab_a1_b3 ab_3 (never executed) Filter: ((a = $1) AND (b = $0)) -> Seq Scan on xy_1 (actual rows=0 loops=1) Filter: ((x = $1) AND (y = $0)) Rows Removed by Filter: 1 - -> Seq Scan on ab_a1_b1 ab_3 (never executed) + -> Seq Scan on ab_a1_b1 ab_4 (never executed) Filter: ((a = $1) AND (b = $0)) - -> Seq Scan on ab_a1_b2 ab_4 (never executed) + -> Seq Scan on ab_a1_b2 ab_5 (never executed) Filter: ((a = $1) AND (b = $0)) - -> Seq Scan on ab_a1_b3 ab_5 (never executed) + -> Seq Scan on ab_a1_b3 ab_6 (never executed) Filter: ((a = $1) AND (b = $0)) (19 rows) @@ -2446,16 +2446,16 @@ update ab_a1 set b = 3 from ab where ab.a = 1 and ab.a = ab_a1.a; Update on ab_a1_b3 ab_a1_3 -> Nested Loop (actual rows=0 loops=1) -> Append (actual rows=1 loops=1) - -> Bitmap Heap Scan on ab_a1_b1 ab (actual rows=0 loops=1) + -> Bitmap Heap Scan on ab_a1_b1 ab_1 (actual rows=0 loops=1) Recheck Cond: (a = 1) -> Bitmap Index Scan on ab_a1_b1_a_idx (actual rows=0 loops=1) Index Cond: (a = 1) - -> Bitmap Heap Scan on ab_a1_b2 ab_1 (actual rows=1 loops=1) + -> Bitmap Heap Scan on ab_a1_b2 ab_2 (actual rows=1 loops=1) Recheck Cond: (a = 1) Heap Blocks: exact=1 -> Bitmap Index Scan on ab_a1_b2_a_idx (actual rows=1 loops=1) Index Cond: (a = 1) - -> Bitmap Heap Scan on ab_a1_b3 ab_2 (actual rows=0 loops=1) + -> Bitmap Heap Scan on ab_a1_b3 ab_3 (actual rows=0 loops=1) Recheck Cond: (a = 1) -> Bitmap Index Scan on ab_a1_b3_a_idx (actual rows=0 loops=1) Index Cond: (a = 1) @@ -2466,16 +2466,16 @@ update ab_a1 set b = 3 from ab where ab.a = 1 and ab.a = ab_a1.a; Index Cond: (a = 1) -> Nested Loop (actual rows=1 loops=1) -> Append (actual rows=1 loops=1) - -> Bitmap Heap Scan on ab_a1_b1 ab (actual rows=0 loops=1) + -> Bitmap Heap Scan on ab_a1_b1 ab_1 (actual rows=0 loops=1) Recheck Cond: (a = 1) -> Bitmap Index Scan on ab_a1_b1_a_idx (actual rows=0 loops=1) Index Cond: (a = 1) - -> Bitmap Heap Scan on ab_a1_b2 ab_1 (actual rows=1 loops=1) + -> Bitmap Heap Scan on ab_a1_b2 ab_2 (actual rows=1 loops=1) Recheck Cond: (a = 1) Heap Blocks: exact=1 -> Bitmap Index Scan on ab_a1_b2_a_idx (actual rows=1 loops=1) Index Cond: (a = 1) - -> Bitmap Heap Scan on ab_a1_b3 ab_2 (actual rows=0 loops=1) + -> Bitmap Heap Scan on ab_a1_b3 ab_3 (actual rows=0 loops=1) Recheck Cond: (a = 1) -> Bitmap Index Scan on ab_a1_b3_a_idx (actual rows=1 loops=1) Index Cond: (a = 1) @@ -2487,16 +2487,16 @@ update ab_a1 set b = 3 from ab where ab.a = 1 and ab.a = ab_a1.a; Index Cond: (a = 1) -> Nested Loop (actual rows=0 loops=1) -> Append (actual rows=1 loops=1) - -> Bitmap Heap Scan on ab_a1_b1 ab (actual rows=0 loops=1) + -> Bitmap Heap Scan on ab_a1_b1 ab_1 (actual rows=0 loops=1) Recheck Cond: (a = 1) -> Bitmap Index Scan on ab_a1_b1_a_idx (actual rows=0 loops=1) Index Cond: (a = 1) - -> Bitmap Heap Scan on ab_a1_b2 ab_1 (actual rows=1 loops=1) + -> Bitmap Heap Scan on ab_a1_b2 ab_2 (actual rows=1 loops=1) Recheck Cond: (a = 1) Heap Blocks: exact=1 -> Bitmap Index Scan on ab_a1_b2_a_idx (actual rows=1 loops=1) Index Cond: (a = 1) - -> Bitmap Heap Scan on ab_a1_b3 ab_2 (actual rows=0 loops=1) + -> Bitmap Heap Scan on ab_a1_b3 ab_3 (actual rows=0 loops=1) Recheck Cond: (a = 1) -> Bitmap Index Scan on ab_a1_b3_a_idx (actual rows=1 loops=1) Index Cond: (a = 1) @@ -2518,8 +2518,8 @@ truncate ab; insert into ab values (1, 1), (1, 2), (1, 3), (2, 1); explain (analyze, costs off, summary off, timing off) update ab_a1 set b = 3 from ab_a2 where ab_a2.b = (select 1); - QUERY PLAN ----------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------ Update on ab_a1 (actual rows=0 loops=1) Update on ab_a1_b1 ab_a1_1 Update on ab_a1_b2 ab_a1_2 @@ -2530,31 +2530,31 @@ update ab_a1 set b = 3 from ab_a2 where ab_a2.b = (select 1); -> Seq Scan on ab_a1_b1 ab_a1_1 (actual rows=1 loops=1) -> Materialize (actual rows=1 loops=1) -> Append (actual rows=1 loops=1) - -> Seq Scan on ab_a2_b1 ab_a2 (actual rows=1 loops=1) + -> Seq Scan on ab_a2_b1 ab_a2_1 (actual rows=1 loops=1) Filter: (b = $0) - -> Seq Scan on ab_a2_b2 ab_a2_1 (never executed) + -> Seq Scan on ab_a2_b2 ab_a2_2 (never executed) Filter: (b = $0) - -> Seq Scan on ab_a2_b3 ab_a2_2 (never executed) + -> Seq Scan on ab_a2_b3 ab_a2_3 (never executed) Filter: (b = $0) -> Nested Loop (actual rows=1 loops=1) -> Seq Scan on ab_a1_b2 ab_a1_2 (actual rows=1 loops=1) -> Materialize (actual rows=1 loops=1) -> Append (actual rows=1 loops=1) - -> Seq Scan on ab_a2_b1 ab_a2 (actual rows=1 loops=1) + -> Seq Scan on ab_a2_b1 ab_a2_1 (actual rows=1 loops=1) Filter: (b = $0) - -> Seq Scan on ab_a2_b2 ab_a2_1 (never executed) + -> Seq Scan on ab_a2_b2 ab_a2_2 (never executed) Filter: (b = $0) - -> Seq Scan on ab_a2_b3 ab_a2_2 (never executed) + -> Seq Scan on ab_a2_b3 ab_a2_3 (never executed) Filter: (b = $0) -> Nested Loop (actual rows=1 loops=1) -> Seq Scan on ab_a1_b3 ab_a1_3 (actual rows=1 loops=1) -> Materialize (actual rows=1 loops=1) -> Append (actual rows=1 loops=1) - -> Seq Scan on ab_a2_b1 ab_a2 (actual rows=1 loops=1) + -> Seq Scan on ab_a2_b1 ab_a2_1 (actual rows=1 loops=1) Filter: (b = $0) - -> Seq Scan on ab_a2_b2 ab_a2_1 (never executed) + -> Seq Scan on ab_a2_b2 ab_a2_2 (never executed) Filter: (b = $0) - -> Seq Scan on ab_a2_b3 ab_a2_2 (never executed) + -> Seq Scan on ab_a2_b3 ab_a2_3 (never executed) Filter: (b = $0) (36 rows) @@ -2590,43 +2590,43 @@ set enable_hashjoin = off; set enable_mergejoin = off; explain (analyze, costs off, summary off, timing off) select * from tbl1 join tprt on tbl1.col1 > tprt.col1; - QUERY PLAN ---------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------- Nested Loop (actual rows=6 loops=1) -> Seq Scan on tbl1 (actual rows=2 loops=1) -> Append (actual rows=3 loops=2) - -> Index Scan using tprt1_idx on tprt_1 tprt (actual rows=2 loops=2) + -> Index Scan using tprt1_idx on tprt_1 (actual rows=2 loops=2) Index Cond: (col1 < tbl1.col1) - -> Index Scan using tprt2_idx on tprt_2 tprt_1 (actual rows=2 loops=1) + -> Index Scan using tprt2_idx on tprt_2 (actual rows=2 loops=1) Index Cond: (col1 < tbl1.col1) - -> Index Scan using tprt3_idx on tprt_3 tprt_2 (never executed) + -> Index Scan using tprt3_idx on tprt_3 (never executed) Index Cond: (col1 < tbl1.col1) - -> Index Scan using tprt4_idx on tprt_4 tprt_3 (never executed) + -> Index Scan using tprt4_idx on tprt_4 (never executed) Index Cond: (col1 < tbl1.col1) - -> Index Scan using tprt5_idx on tprt_5 tprt_4 (never executed) + -> Index Scan using tprt5_idx on tprt_5 (never executed) Index Cond: (col1 < tbl1.col1) - -> Index Scan using tprt6_idx on tprt_6 tprt_5 (never executed) + -> Index Scan using tprt6_idx on tprt_6 (never executed) Index Cond: (col1 < tbl1.col1) (15 rows) explain (analyze, costs off, summary off, timing off) select * from tbl1 join tprt on tbl1.col1 = tprt.col1; - QUERY PLAN ---------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------- Nested Loop (actual rows=2 loops=1) -> Seq Scan on tbl1 (actual rows=2 loops=1) -> Append (actual rows=1 loops=2) - -> Index Scan using tprt1_idx on tprt_1 tprt (never executed) + -> Index Scan using tprt1_idx on tprt_1 (never executed) Index Cond: (col1 = tbl1.col1) - -> Index Scan using tprt2_idx on tprt_2 tprt_1 (actual rows=1 loops=2) + -> Index Scan using tprt2_idx on tprt_2 (actual rows=1 loops=2) Index Cond: (col1 = tbl1.col1) - -> Index Scan using tprt3_idx on tprt_3 tprt_2 (never executed) + -> Index Scan using tprt3_idx on tprt_3 (never executed) Index Cond: (col1 = tbl1.col1) - -> Index Scan using tprt4_idx on tprt_4 tprt_3 (never executed) + -> Index Scan using tprt4_idx on tprt_4 (never executed) Index Cond: (col1 = tbl1.col1) - -> Index Scan using tprt5_idx on tprt_5 tprt_4 (never executed) + -> Index Scan using tprt5_idx on tprt_5 (never executed) Index Cond: (col1 = tbl1.col1) - -> Index Scan using tprt6_idx on tprt_6 tprt_5 (never executed) + -> Index Scan using tprt6_idx on tprt_6 (never executed) Index Cond: (col1 = tbl1.col1) (15 rows) @@ -2656,43 +2656,43 @@ order by tbl1.col1, tprt.col1; insert into tbl1 values (1001), (1010), (1011); explain (analyze, costs off, summary off, timing off) select * from tbl1 inner join tprt on tbl1.col1 > tprt.col1; - QUERY PLAN ---------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------- Nested Loop (actual rows=23 loops=1) -> Seq Scan on tbl1 (actual rows=5 loops=1) -> Append (actual rows=5 loops=5) - -> Index Scan using tprt1_idx on tprt_1 tprt (actual rows=2 loops=5) + -> Index Scan using tprt1_idx on tprt_1 (actual rows=2 loops=5) Index Cond: (col1 < tbl1.col1) - -> Index Scan using tprt2_idx on tprt_2 tprt_1 (actual rows=3 loops=4) + -> Index Scan using tprt2_idx on tprt_2 (actual rows=3 loops=4) Index Cond: (col1 < tbl1.col1) - -> Index Scan using tprt3_idx on tprt_3 tprt_2 (actual rows=1 loops=2) + -> Index Scan using tprt3_idx on tprt_3 (actual rows=1 loops=2) Index Cond: (col1 < tbl1.col1) - -> Index Scan using tprt4_idx on tprt_4 tprt_3 (never executed) + -> Index Scan using tprt4_idx on tprt_4 (never executed) Index Cond: (col1 < tbl1.col1) - -> Index Scan using tprt5_idx on tprt_5 tprt_4 (never executed) + -> Index Scan using tprt5_idx on tprt_5 (never executed) Index Cond: (col1 < tbl1.col1) - -> Index Scan using tprt6_idx on tprt_6 tprt_5 (never executed) + -> Index Scan using tprt6_idx on tprt_6 (never executed) Index Cond: (col1 < tbl1.col1) (15 rows) explain (analyze, costs off, summary off, timing off) select * from tbl1 inner join tprt on tbl1.col1 = tprt.col1; - QUERY PLAN ---------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------- Nested Loop (actual rows=3 loops=1) -> Seq Scan on tbl1 (actual rows=5 loops=1) -> Append (actual rows=1 loops=5) - -> Index Scan using tprt1_idx on tprt_1 tprt (never executed) + -> Index Scan using tprt1_idx on tprt_1 (never executed) Index Cond: (col1 = tbl1.col1) - -> Index Scan using tprt2_idx on tprt_2 tprt_1 (actual rows=1 loops=2) + -> Index Scan using tprt2_idx on tprt_2 (actual rows=1 loops=2) Index Cond: (col1 = tbl1.col1) - -> Index Scan using tprt3_idx on tprt_3 tprt_2 (actual rows=0 loops=3) + -> Index Scan using tprt3_idx on tprt_3 (actual rows=0 loops=3) Index Cond: (col1 = tbl1.col1) - -> Index Scan using tprt4_idx on tprt_4 tprt_3 (never executed) + -> Index Scan using tprt4_idx on tprt_4 (never executed) Index Cond: (col1 = tbl1.col1) - -> Index Scan using tprt5_idx on tprt_5 tprt_4 (never executed) + -> Index Scan using tprt5_idx on tprt_5 (never executed) Index Cond: (col1 = tbl1.col1) - -> Index Scan using tprt6_idx on tprt_6 tprt_5 (never executed) + -> Index Scan using tprt6_idx on tprt_6 (never executed) Index Cond: (col1 = tbl1.col1) (15 rows) @@ -2741,22 +2741,22 @@ delete from tbl1; insert into tbl1 values (4400); explain (analyze, costs off, summary off, timing off) select * from tbl1 join tprt on tbl1.col1 < tprt.col1; - QUERY PLAN ---------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------- Nested Loop (actual rows=1 loops=1) -> Seq Scan on tbl1 (actual rows=1 loops=1) -> Append (actual rows=1 loops=1) - -> Index Scan using tprt1_idx on tprt_1 tprt (never executed) + -> Index Scan using tprt1_idx on tprt_1 (never executed) Index Cond: (col1 > tbl1.col1) - -> Index Scan using tprt2_idx on tprt_2 tprt_1 (never executed) + -> Index Scan using tprt2_idx on tprt_2 (never executed) Index Cond: (col1 > tbl1.col1) - -> Index Scan using tprt3_idx on tprt_3 tprt_2 (never executed) + -> Index Scan using tprt3_idx on tprt_3 (never executed) Index Cond: (col1 > tbl1.col1) - -> Index Scan using tprt4_idx on tprt_4 tprt_3 (never executed) + -> Index Scan using tprt4_idx on tprt_4 (never executed) Index Cond: (col1 > tbl1.col1) - -> Index Scan using tprt5_idx on tprt_5 tprt_4 (never executed) + -> Index Scan using tprt5_idx on tprt_5 (never executed) Index Cond: (col1 > tbl1.col1) - -> Index Scan using tprt6_idx on tprt_6 tprt_5 (actual rows=1 loops=1) + -> Index Scan using tprt6_idx on tprt_6 (actual rows=1 loops=1) Index Cond: (col1 > tbl1.col1) (15 rows) @@ -2773,22 +2773,22 @@ delete from tbl1; insert into tbl1 values (10000); explain (analyze, costs off, summary off, timing off) select * from tbl1 join tprt on tbl1.col1 = tprt.col1; - QUERY PLAN --------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------- Nested Loop (actual rows=0 loops=1) -> Seq Scan on tbl1 (actual rows=1 loops=1) -> Append (actual rows=0 loops=1) - -> Index Scan using tprt1_idx on tprt_1 tprt (never executed) + -> Index Scan using tprt1_idx on tprt_1 (never executed) Index Cond: (col1 = tbl1.col1) - -> Index Scan using tprt2_idx on tprt_2 tprt_1 (never executed) + -> Index Scan using tprt2_idx on tprt_2 (never executed) Index Cond: (col1 = tbl1.col1) - -> Index Scan using tprt3_idx on tprt_3 tprt_2 (never executed) + -> Index Scan using tprt3_idx on tprt_3 (never executed) Index Cond: (col1 = tbl1.col1) - -> Index Scan using tprt4_idx on tprt_4 tprt_3 (never executed) + -> Index Scan using tprt4_idx on tprt_4 (never executed) Index Cond: (col1 = tbl1.col1) - -> Index Scan using tprt5_idx on tprt_5 tprt_4 (never executed) + -> Index Scan using tprt5_idx on tprt_5 (never executed) Index Cond: (col1 = tbl1.col1) - -> Index Scan using tprt6_idx on tprt_6 tprt_5 (never executed) + -> Index Scan using tprt6_idx on tprt_6 (never executed) Index Cond: (col1 = tbl1.col1) (15 rows) @@ -2837,31 +2837,31 @@ select * from listp where b = 1; -- which match the given parameter. prepare q1 (int,int) as select * from listp where b in ($1,$2); explain (analyze, costs off, summary off, timing off) execute q1 (1,1); - QUERY PLAN ------------------------------------------------------------ + QUERY PLAN +------------------------------------------------------------- Append (actual rows=0 loops=1) Subplans Removed: 1 - -> Seq Scan on listp_1_1 listp (actual rows=0 loops=1) + -> Seq Scan on listp_1_1 listp_1 (actual rows=0 loops=1) Filter: (b = ANY (ARRAY[$1, $2])) (4 rows) explain (analyze, costs off, summary off, timing off) execute q1 (2,2); - QUERY PLAN ------------------------------------------------------------ + QUERY PLAN +------------------------------------------------------------- Append (actual rows=0 loops=1) Subplans Removed: 1 - -> Seq Scan on listp_2_1 listp (actual rows=0 loops=1) + -> Seq Scan on listp_2_1 listp_1 (actual rows=0 loops=1) Filter: (b = ANY (ARRAY[$1, $2])) (4 rows) -- Try with no matching partitions. One subplan should remain in this case, -- but it shouldn't be executed. explain (analyze, costs off, summary off, timing off) execute q1 (0,0); - QUERY PLAN ----------------------------------------------------- + QUERY PLAN +------------------------------------------------------ Append (actual rows=0 loops=1) Subplans Removed: 1 - -> Seq Scan on listp_1_1 listp (never executed) + -> Seq Scan on listp_1_1 listp_1 (never executed) Filter: (b = ANY (ARRAY[$1, $2])) (4 rows) @@ -2874,7 +2874,7 @@ explain (analyze, costs off, summary off, timing off) execute q1 (1,2,2,0); ------------------------------------------------------------------------- Append (actual rows=0 loops=1) Subplans Removed: 1 - -> Seq Scan on listp_1_1 listp (actual rows=0 loops=1) + -> Seq Scan on listp_1_1 listp_1 (actual rows=0 loops=1) Filter: ((b = ANY (ARRAY[$1, $2])) AND ($3 <> b) AND ($4 <> b)) (4 rows) @@ -2885,7 +2885,7 @@ explain (analyze, costs off, summary off, timing off) execute q1 (1,2,2,1); ------------------------------------------------------------------------- Append (actual rows=0 loops=1) Subplans Removed: 1 - -> Seq Scan on listp_1_1 listp (never executed) + -> Seq Scan on listp_1_1 listp_1 (never executed) Filter: ((b = ANY (ARRAY[$1, $2])) AND ($3 <> b) AND ($4 <> b)) (4 rows) @@ -2897,9 +2897,9 @@ select * from listp where a = (select null::int); Append (actual rows=0 loops=1) InitPlan 1 (returns $0) -> Result (actual rows=1 loops=1) - -> Seq Scan on listp_1_1 listp (never executed) + -> Seq Scan on listp_1_1 listp_1 (never executed) Filter: (a = $0) - -> Seq Scan on listp_2_1 listp_1 (never executed) + -> Seq Scan on listp_2_1 listp_2 (never executed) Filter: (a = $0) (7 rows) @@ -2921,20 +2921,20 @@ select * from stable_qual_pruning where a < localtimestamp; -------------------------------------------------------------------------------------- Append (actual rows=0 loops=1) Subplans Removed: 1 - -> Seq Scan on stable_qual_pruning1 stable_qual_pruning (actual rows=0 loops=1) + -> Seq Scan on stable_qual_pruning1 stable_qual_pruning_1 (actual rows=0 loops=1) Filter: (a < LOCALTIMESTAMP) - -> Seq Scan on stable_qual_pruning2 stable_qual_pruning_1 (actual rows=0 loops=1) + -> Seq Scan on stable_qual_pruning2 stable_qual_pruning_2 (actual rows=0 loops=1) Filter: (a < LOCALTIMESTAMP) (6 rows) -- timestamp < timestamptz comparison is only stable, not immutable explain (analyze, costs off, summary off, timing off) select * from stable_qual_pruning where a < '2000-02-01'::timestamptz; - QUERY PLAN ------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------- Append (actual rows=0 loops=1) Subplans Removed: 2 - -> Seq Scan on stable_qual_pruning1 stable_qual_pruning (actual rows=0 loops=1) + -> Seq Scan on stable_qual_pruning1 stable_qual_pruning_1 (actual rows=0 loops=1) Filter: (a < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) (4 rows) @@ -2964,7 +2964,7 @@ select * from stable_qual_pruning ------------------------------------------------------------------------------------------------------------ Append (actual rows=0 loops=1) Subplans Removed: 2 - -> Seq Scan on stable_qual_pruning2 stable_qual_pruning (actual rows=0 loops=1) + -> Seq Scan on stable_qual_pruning2 stable_qual_pruning_1 (actual rows=0 loops=1) Filter: (a = ANY (ARRAY['Tue Feb 01 00:00:00 2000'::timestamp without time zone, LOCALTIMESTAMP])) (4 rows) @@ -2975,7 +2975,7 @@ select * from stable_qual_pruning --------------------------------------------------------------------------------------------------------------------------- Append (actual rows=0 loops=1) Subplans Removed: 2 - -> Seq Scan on stable_qual_pruning1 stable_qual_pruning (never executed) + -> Seq Scan on stable_qual_pruning1 stable_qual_pruning_1 (never executed) Filter: (a = ANY ('{"Mon Feb 01 00:00:00 2010 PST","Wed Jan 01 00:00:00 2020 PST"}'::timestamp with time zone[])) (4 rows) @@ -2986,7 +2986,7 @@ select * from stable_qual_pruning --------------------------------------------------------------------------------------------------------------------------- Append (actual rows=0 loops=1) Subplans Removed: 2 - -> Seq Scan on stable_qual_pruning2 stable_qual_pruning (actual rows=0 loops=1) + -> Seq Scan on stable_qual_pruning2 stable_qual_pruning_1 (actual rows=0 loops=1) Filter: (a = ANY ('{"Tue Feb 01 00:00:00 2000 PST","Fri Jan 01 00:00:00 2010 PST"}'::timestamp with time zone[])) (4 rows) @@ -2996,11 +2996,11 @@ select * from stable_qual_pruning QUERY PLAN -------------------------------------------------------------------------------------- Append (actual rows=0 loops=1) - -> Seq Scan on stable_qual_pruning1 stable_qual_pruning (actual rows=0 loops=1) + -> Seq Scan on stable_qual_pruning1 stable_qual_pruning_1 (actual rows=0 loops=1) Filter: (a = ANY (NULL::timestamp with time zone[])) - -> Seq Scan on stable_qual_pruning2 stable_qual_pruning_1 (actual rows=0 loops=1) + -> Seq Scan on stable_qual_pruning2 stable_qual_pruning_2 (actual rows=0 loops=1) Filter: (a = ANY (NULL::timestamp with time zone[])) - -> Seq Scan on stable_qual_pruning3 stable_qual_pruning_2 (actual rows=0 loops=1) + -> Seq Scan on stable_qual_pruning3 stable_qual_pruning_3 (actual rows=0 loops=1) Filter: (a = ANY (NULL::timestamp with time zone[])) (7 rows) @@ -3023,11 +3023,11 @@ select * from mc3p where a < 3 and abs(b) = 1; QUERY PLAN -------------------------------------------------------- Append (actual rows=3 loops=1) - -> Seq Scan on mc3p0 mc3p (actual rows=1 loops=1) + -> Seq Scan on mc3p0 mc3p_1 (actual rows=1 loops=1) Filter: ((a < 3) AND (abs(b) = 1)) - -> Seq Scan on mc3p1 mc3p_1 (actual rows=1 loops=1) + -> Seq Scan on mc3p1 mc3p_2 (actual rows=1 loops=1) Filter: ((a < 3) AND (abs(b) = 1)) - -> Seq Scan on mc3p2 mc3p_2 (actual rows=1 loops=1) + -> Seq Scan on mc3p2 mc3p_3 (actual rows=1 loops=1) Filter: ((a < 3) AND (abs(b) = 1)) (7 rows) @@ -3040,13 +3040,13 @@ prepare ps1 as select * from mc3p where a = $1 and abs(b) < (select 3); explain (analyze, costs off, summary off, timing off) execute ps1(1); - QUERY PLAN ------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------- Append (actual rows=1 loops=1) InitPlan 1 (returns $0) -> Result (actual rows=1 loops=1) Subplans Removed: 2 - -> Seq Scan on mc3p1 mc3p (actual rows=1 loops=1) + -> Seq Scan on mc3p1 mc3p_1 (actual rows=1 loops=1) Filter: ((a = $1) AND (abs(b) < $0)) (6 rows) @@ -3061,9 +3061,9 @@ execute ps2(1); InitPlan 1 (returns $0) -> Result (actual rows=1 loops=1) Subplans Removed: 1 - -> Seq Scan on mc3p0 mc3p (actual rows=1 loops=1) + -> Seq Scan on mc3p0 mc3p_1 (actual rows=1 loops=1) Filter: ((a <= $1) AND (abs(b) < $0)) - -> Seq Scan on mc3p1 mc3p_1 (actual rows=1 loops=1) + -> Seq Scan on mc3p1 mc3p_2 (actual rows=1 loops=1) Filter: ((a <= $1) AND (abs(b) < $0)) (8 rows) @@ -3084,24 +3084,24 @@ select * from boolp where a = (select value from boolvalues where value); -> Seq Scan on boolvalues (actual rows=1 loops=1) Filter: value Rows Removed by Filter: 1 - -> Seq Scan on boolp_f boolp (never executed) + -> Seq Scan on boolp_f boolp_1 (never executed) Filter: (a = $0) - -> Seq Scan on boolp_t boolp_1 (actual rows=0 loops=1) + -> Seq Scan on boolp_t boolp_2 (actual rows=0 loops=1) Filter: (a = $0) (9 rows) explain (analyze, costs off, summary off, timing off) select * from boolp where a = (select value from boolvalues where not value); - QUERY PLAN ---------------------------------------------------------- + QUERY PLAN +----------------------------------------------------------- Append (actual rows=0 loops=1) InitPlan 1 (returns $0) -> Seq Scan on boolvalues (actual rows=1 loops=1) Filter: (NOT value) Rows Removed by Filter: 1 - -> Seq Scan on boolp_f boolp (actual rows=0 loops=1) + -> Seq Scan on boolp_f boolp_1 (actual rows=0 loops=1) Filter: (a = $0) - -> Seq Scan on boolp_t boolp_1 (never executed) + -> Seq Scan on boolp_t boolp_2 (never executed) Filter: (a = $0) (9 rows) @@ -3125,10 +3125,10 @@ explain (analyze, costs off, summary off, timing off) execute mt_q1(15); Merge Append (actual rows=2 loops=1) Sort Key: ma_test.b Subplans Removed: 1 - -> Index Scan using ma_test_p2_b_idx on ma_test_p2 ma_test (actual rows=1 loops=1) + -> Index Scan using ma_test_p2_b_idx on ma_test_p2 ma_test_1 (actual rows=1 loops=1) Filter: ((a >= $1) AND ((a % 10) = 5)) Rows Removed by Filter: 9 - -> Index Scan using ma_test_p3_b_idx on ma_test_p3 ma_test_1 (actual rows=1 loops=1) + -> Index Scan using ma_test_p3_b_idx on ma_test_p3 ma_test_2 (actual rows=1 loops=1) Filter: ((a >= $1) AND ((a % 10) = 5)) Rows Removed by Filter: 9 (9 rows) @@ -3141,12 +3141,12 @@ execute mt_q1(15); (2 rows) explain (analyze, costs off, summary off, timing off) execute mt_q1(25); - QUERY PLAN ---------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------------------------------------------- Merge Append (actual rows=1 loops=1) Sort Key: ma_test.b Subplans Removed: 2 - -> Index Scan using ma_test_p3_b_idx on ma_test_p3 ma_test (actual rows=1 loops=1) + -> Index Scan using ma_test_p3_b_idx on ma_test_p3 ma_test_1 (actual rows=1 loops=1) Filter: ((a >= $1) AND ((a % 10) = 5)) Rows Removed by Filter: 9 (6 rows) @@ -3159,12 +3159,12 @@ execute mt_q1(25); -- Ensure MergeAppend behaves correctly when no subplans match explain (analyze, costs off, summary off, timing off) execute mt_q1(35); - QUERY PLAN --------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------- Merge Append (actual rows=0 loops=1) Sort Key: ma_test.b Subplans Removed: 2 - -> Index Scan using ma_test_p1_b_idx on ma_test_p1 ma_test (never executed) + -> Index Scan using ma_test_p1_b_idx on ma_test_p1 ma_test_1 (never executed) Filter: ((a >= $1) AND ((a % 10) = 5)) (5 rows) @@ -3186,11 +3186,11 @@ explain (analyze, costs off, summary off, timing off) select * from ma_test wher -> Limit (actual rows=1 loops=1) -> Index Scan using ma_test_p2_b_idx on ma_test_p2 (actual rows=1 loops=1) Index Cond: (b IS NOT NULL) - -> Index Scan using ma_test_p1_b_idx on ma_test_p1 ma_test (never executed) + -> Index Scan using ma_test_p1_b_idx on ma_test_p1 ma_test_1 (never executed) Filter: (a >= $1) - -> Index Scan using ma_test_p2_b_idx on ma_test_p2 ma_test_1 (actual rows=10 loops=1) + -> Index Scan using ma_test_p2_b_idx on ma_test_p2 ma_test_2 (actual rows=10 loops=1) Filter: (a >= $1) - -> Index Scan using ma_test_p3_b_idx on ma_test_p3 ma_test_2 (actual rows=10 loops=1) + -> Index Scan using ma_test_p3_b_idx on ma_test_p3 ma_test_3 (actual rows=10 loops=1) Filter: (a >= $1) (14 rows) @@ -3224,9 +3224,9 @@ explain (costs off) select * from pp_arrpart where a in ('{4, 5}', '{1}'); QUERY PLAN ---------------------------------------------------------------------- Append - -> Seq Scan on pp_arrpart1 pp_arrpart + -> Seq Scan on pp_arrpart1 pp_arrpart_1 Filter: ((a = '{4,5}'::integer[]) OR (a = '{1}'::integer[])) - -> Seq Scan on pp_arrpart2 pp_arrpart_1 + -> Seq Scan on pp_arrpart2 pp_arrpart_2 Filter: ((a = '{4,5}'::integer[]) OR (a = '{1}'::integer[])) (5 rows) @@ -3280,9 +3280,9 @@ explain (costs off) select * from pph_arrpart where a in ('{4, 5}', '{1}'); QUERY PLAN ---------------------------------------------------------------------- Append - -> Seq Scan on pph_arrpart1 pph_arrpart + -> Seq Scan on pph_arrpart1 pph_arrpart_1 Filter: ((a = '{4,5}'::integer[]) OR (a = '{1}'::integer[])) - -> Seq Scan on pph_arrpart2 pph_arrpart_1 + -> Seq Scan on pph_arrpart2 pph_arrpart_2 Filter: ((a = '{4,5}'::integer[]) OR (a = '{1}'::integer[])) (5 rows) @@ -3385,9 +3385,9 @@ explain (costs off) select * from pp_lp where a = 1; QUERY PLAN ---------------------------------- Append - -> Seq Scan on pp_lp1 pp_lp + -> Seq Scan on pp_lp1 pp_lp_1 Filter: (a = 1) - -> Seq Scan on pp_lp2 pp_lp_1 + -> Seq Scan on pp_lp2 pp_lp_2 Filter: (a = 1) (5 rows) @@ -3420,9 +3420,9 @@ explain (costs off) select * from pp_lp where a = 1; QUERY PLAN ---------------------------------- Append - -> Seq Scan on pp_lp1 pp_lp + -> Seq Scan on pp_lp1 pp_lp_1 Filter: (a = 1) - -> Seq Scan on pp_lp2 pp_lp_1 + -> Seq Scan on pp_lp2 pp_lp_2 Filter: (a = 1) (5 rows) @@ -3465,9 +3465,9 @@ explain (costs off) select * from inh_lp where a = 1; QUERY PLAN ------------------------------------ Append - -> Seq Scan on inh_lp + -> Seq Scan on inh_lp inh_lp_1 Filter: (a = 1) - -> Seq Scan on inh_lp1 inh_lp_1 + -> Seq Scan on inh_lp1 inh_lp_2 Filter: (a = 1) (5 rows) @@ -3519,8 +3519,8 @@ explain (costs off) select * from pp_temp_parent where true; QUERY PLAN ----------------------------------------------------- Append - -> Seq Scan on pp_temp_part_1 pp_temp_parent - -> Seq Scan on pp_temp_part_def pp_temp_parent_1 + -> Seq Scan on pp_temp_part_1 pp_temp_parent_1 + -> Seq Scan on pp_temp_part_def pp_temp_parent_2 (3 rows) explain (costs off) select * from pp_temp_parent where a = 2; diff --git a/src/test/regress/expected/rowsecurity.out b/src/test/regress/expected/rowsecurity.out index d2b846c884..9506aaef82 100644 --- a/src/test/regress/expected/rowsecurity.out +++ b/src/test/regress/expected/rowsecurity.out @@ -662,11 +662,11 @@ EXPLAIN (COSTS OFF) SELECT * FROM t1; QUERY PLAN ------------------------------- Append - -> Seq Scan on t1 + -> Seq Scan on t1 t1_1 Filter: ((a % 2) = 0) - -> Seq Scan on t2 t1_1 + -> Seq Scan on t2 t1_2 Filter: ((a % 2) = 0) - -> Seq Scan on t3 t1_2 + -> Seq Scan on t3 t1_3 Filter: ((a % 2) = 0) (7 rows) @@ -689,11 +689,11 @@ EXPLAIN (COSTS OFF) SELECT * FROM t1 WHERE f_leak(b); QUERY PLAN ----------------------------------------------- Append - -> Seq Scan on t1 + -> Seq Scan on t1 t1_1 Filter: (((a % 2) = 0) AND f_leak(b)) - -> Seq Scan on t2 t1_1 + -> Seq Scan on t2 t1_2 Filter: (((a % 2) = 0) AND f_leak(b)) - -> Seq Scan on t3 t1_2 + -> Seq Scan on t3 t1_3 Filter: (((a % 2) = 0) AND f_leak(b)) (7 rows) @@ -712,11 +712,11 @@ EXPLAIN (COSTS OFF) SELECT *, t1 FROM t1; QUERY PLAN ------------------------------- Append - -> Seq Scan on t1 + -> Seq Scan on t1 t1_1 Filter: ((a % 2) = 0) - -> Seq Scan on t2 t1_1 + -> Seq Scan on t2 t1_2 Filter: ((a % 2) = 0) - -> Seq Scan on t3 t1_2 + -> Seq Scan on t3 t1_3 Filter: ((a % 2) = 0) (7 rows) @@ -735,11 +735,11 @@ EXPLAIN (COSTS OFF) SELECT *, t1 FROM t1; QUERY PLAN ------------------------------- Append - -> Seq Scan on t1 + -> Seq Scan on t1 t1_1 Filter: ((a % 2) = 0) - -> Seq Scan on t2 t1_1 + -> Seq Scan on t2 t1_2 Filter: ((a % 2) = 0) - -> Seq Scan on t3 t1_2 + -> Seq Scan on t3 t1_3 Filter: ((a % 2) = 0) (7 rows) @@ -759,11 +759,11 @@ EXPLAIN (COSTS OFF) SELECT * FROM t1 FOR SHARE; ------------------------------------- LockRows -> Append - -> Seq Scan on t1 + -> Seq Scan on t1 t1_1 Filter: ((a % 2) = 0) - -> Seq Scan on t2 t1_1 + -> Seq Scan on t2 t1_2 Filter: ((a % 2) = 0) - -> Seq Scan on t3 t1_2 + -> Seq Scan on t3 t1_3 Filter: ((a % 2) = 0) (8 rows) @@ -787,11 +787,11 @@ EXPLAIN (COSTS OFF) SELECT * FROM t1 WHERE f_leak(b) FOR SHARE; ----------------------------------------------------- LockRows -> Append - -> Seq Scan on t1 + -> Seq Scan on t1 t1_1 Filter: (((a % 2) = 0) AND f_leak(b)) - -> Seq Scan on t2 t1_1 + -> Seq Scan on t2 t1_2 Filter: (((a % 2) = 0) AND f_leak(b)) - -> Seq Scan on t3 t1_2 + -> Seq Scan on t3 t1_3 Filter: (((a % 2) = 0) AND f_leak(b)) (8 rows) @@ -849,11 +849,11 @@ EXPLAIN (COSTS OFF) SELECT * FROM t1 WHERE f_leak(b); QUERY PLAN --------------------------- Append - -> Seq Scan on t1 + -> Seq Scan on t1 t1_1 Filter: f_leak(b) - -> Seq Scan on t2 t1_1 + -> Seq Scan on t2 t1_2 Filter: f_leak(b) - -> Seq Scan on t3 t1_2 + -> Seq Scan on t3 t1_3 Filter: f_leak(b) (7 rows) @@ -891,11 +891,11 @@ EXPLAIN (COSTS OFF) SELECT * FROM t1 WHERE f_leak(b); QUERY PLAN --------------------------- Append - -> Seq Scan on t1 + -> Seq Scan on t1 t1_1 Filter: f_leak(b) - -> Seq Scan on t2 t1_1 + -> Seq Scan on t2 t1_2 Filter: f_leak(b) - -> Seq Scan on t3 t1_2 + -> Seq Scan on t3 t1_3 Filter: f_leak(b) (7 rows) @@ -991,11 +991,11 @@ EXPLAIN (COSTS OFF) SELECT * FROM part_document WHERE f_leak(dtitle); InitPlan 1 (returns $0) -> Index Scan using uaccount_pkey on uaccount Index Cond: (pguser = CURRENT_USER) - -> Seq Scan on part_document_fiction part_document + -> Seq Scan on part_document_fiction part_document_1 Filter: ((dlevel <= $0) AND f_leak(dtitle)) - -> Seq Scan on part_document_satire part_document_1 + -> Seq Scan on part_document_satire part_document_2 Filter: ((dlevel <= $0) AND f_leak(dtitle)) - -> Seq Scan on part_document_nonfiction part_document_2 + -> Seq Scan on part_document_nonfiction part_document_3 Filter: ((dlevel <= $0) AND f_leak(dtitle)) (10 rows) @@ -1033,11 +1033,11 @@ EXPLAIN (COSTS OFF) SELECT * FROM part_document WHERE f_leak(dtitle); InitPlan 1 (returns $0) -> Index Scan using uaccount_pkey on uaccount Index Cond: (pguser = CURRENT_USER) - -> Seq Scan on part_document_fiction part_document + -> Seq Scan on part_document_fiction part_document_1 Filter: ((dlevel <= $0) AND f_leak(dtitle)) - -> Seq Scan on part_document_satire part_document_1 + -> Seq Scan on part_document_satire part_document_2 Filter: ((dlevel <= $0) AND f_leak(dtitle)) - -> Seq Scan on part_document_nonfiction part_document_2 + -> Seq Scan on part_document_nonfiction part_document_3 Filter: ((dlevel <= $0) AND f_leak(dtitle)) (10 rows) @@ -1180,11 +1180,11 @@ EXPLAIN (COSTS OFF) SELECT * FROM part_document WHERE f_leak(dtitle); InitPlan 1 (returns $0) -> Index Scan using uaccount_pkey on uaccount Index Cond: (pguser = CURRENT_USER) - -> Seq Scan on part_document_fiction part_document + -> Seq Scan on part_document_fiction part_document_1 Filter: ((dlevel <= $0) AND f_leak(dtitle)) - -> Seq Scan on part_document_satire part_document_1 + -> Seq Scan on part_document_satire part_document_2 Filter: ((dlevel <= $0) AND f_leak(dtitle)) - -> Seq Scan on part_document_nonfiction part_document_2 + -> Seq Scan on part_document_nonfiction part_document_3 Filter: ((dlevel <= $0) AND f_leak(dtitle)) (10 rows) @@ -1229,11 +1229,11 @@ EXPLAIN (COSTS OFF) SELECT * FROM part_document WHERE f_leak(dtitle); QUERY PLAN --------------------------------------------------------------- Append - -> Seq Scan on part_document_fiction part_document + -> Seq Scan on part_document_fiction part_document_1 Filter: ((dauthor = CURRENT_USER) AND f_leak(dtitle)) - -> Seq Scan on part_document_satire part_document_1 + -> Seq Scan on part_document_satire part_document_2 Filter: ((dauthor = CURRENT_USER) AND f_leak(dtitle)) - -> Seq Scan on part_document_nonfiction part_document_2 + -> Seq Scan on part_document_nonfiction part_document_3 Filter: ((dauthor = CURRENT_USER) AND f_leak(dtitle)) (7 rows) @@ -1509,11 +1509,11 @@ EXPLAIN (COSTS OFF) EXECUTE p1(2); QUERY PLAN ---------------------------------------------- Append - -> Seq Scan on t1 + -> Seq Scan on t1 t1_1 Filter: ((a <= 2) AND ((a % 2) = 0)) - -> Seq Scan on t2 t1_1 + -> Seq Scan on t2 t1_2 Filter: ((a <= 2) AND ((a % 2) = 0)) - -> Seq Scan on t3 t1_2 + -> Seq Scan on t3 t1_3 Filter: ((a <= 2) AND ((a % 2) = 0)) (7 rows) @@ -1551,11 +1551,11 @@ EXPLAIN (COSTS OFF) SELECT * FROM t1 WHERE f_leak(b); QUERY PLAN --------------------------- Append - -> Seq Scan on t1 + -> Seq Scan on t1 t1_1 Filter: f_leak(b) - -> Seq Scan on t2 t1_1 + -> Seq Scan on t2 t1_2 Filter: f_leak(b) - -> Seq Scan on t3 t1_2 + -> Seq Scan on t3 t1_3 Filter: f_leak(b) (7 rows) @@ -1575,11 +1575,11 @@ EXPLAIN (COSTS OFF) EXECUTE p1(2); QUERY PLAN --------------------------- Append - -> Seq Scan on t1 + -> Seq Scan on t1 t1_1 Filter: (a <= 2) - -> Seq Scan on t2 t1_1 + -> Seq Scan on t2 t1_2 Filter: (a <= 2) - -> Seq Scan on t3 t1_2 + -> Seq Scan on t3 t1_3 Filter: (a <= 2) (7 rows) @@ -1596,11 +1596,11 @@ EXPLAIN (COSTS OFF) EXECUTE p2(2); QUERY PLAN --------------------------- Append - -> Seq Scan on t1 + -> Seq Scan on t1 t1_1 Filter: (a = 2) - -> Seq Scan on t2 t1_1 + -> Seq Scan on t2 t1_2 Filter: (a = 2) - -> Seq Scan on t3 t1_2 + -> Seq Scan on t3 t1_3 Filter: (a = 2) (7 rows) @@ -1619,11 +1619,11 @@ EXPLAIN (COSTS OFF) EXECUTE p2(2); QUERY PLAN --------------------------------------------- Append - -> Seq Scan on t1 + -> Seq Scan on t1 t1_1 Filter: ((a = 2) AND ((a % 2) = 0)) - -> Seq Scan on t2 t1_1 + -> Seq Scan on t2 t1_2 Filter: ((a = 2) AND ((a % 2) = 0)) - -> Seq Scan on t3 t1_2 + -> Seq Scan on t3 t1_3 Filter: ((a = 2) AND ((a % 2) = 0)) (7 rows) @@ -1756,11 +1756,11 @@ WHERE t1.a = 3 and t2.a = 3 AND f_leak(t1.b) AND f_leak(t2.b); -> Seq Scan on t2 Filter: ((a = 3) AND ((a % 2) = 1) AND f_leak(b)) -> Append - -> Seq Scan on t1 + -> Seq Scan on t1 t1_1 Filter: ((a = 3) AND ((a % 2) = 0) AND f_leak(b)) - -> Seq Scan on t2 t1_1 + -> Seq Scan on t2 t1_2 Filter: ((a = 3) AND ((a % 2) = 0) AND f_leak(b)) - -> Seq Scan on t3 t1_2 + -> Seq Scan on t3 t1_3 Filter: ((a = 3) AND ((a % 2) = 0) AND f_leak(b)) (11 rows) @@ -1806,33 +1806,33 @@ AND f_leak(t1_1.b) AND f_leak(t1_2.b) RETURNING *, t1_1, t1_2; -> Seq Scan on t1 t1_1 Filter: ((a = 4) AND ((a % 2) = 0) AND f_leak(b)) -> Append - -> Seq Scan on t1 t1_2 + -> Seq Scan on t1 t1_2_1 Filter: ((a = 4) AND ((a % 2) = 0) AND f_leak(b)) - -> Seq Scan on t2 t1_2_1 + -> Seq Scan on t2 t1_2_2 Filter: ((a = 4) AND ((a % 2) = 0) AND f_leak(b)) - -> Seq Scan on t3 t1_2_2 + -> Seq Scan on t3 t1_2_3 Filter: ((a = 4) AND ((a % 2) = 0) AND f_leak(b)) -> Nested Loop Join Filter: (t1_1_1.b = t1_2.b) -> Seq Scan on t2 t1_1_1 Filter: ((a = 4) AND ((a % 2) = 0) AND f_leak(b)) -> Append - -> Seq Scan on t1 t1_2 + -> Seq Scan on t1 t1_2_1 Filter: ((a = 4) AND ((a % 2) = 0) AND f_leak(b)) - -> Seq Scan on t2 t1_2_1 + -> Seq Scan on t2 t1_2_2 Filter: ((a = 4) AND ((a % 2) = 0) AND f_leak(b)) - -> Seq Scan on t3 t1_2_2 + -> Seq Scan on t3 t1_2_3 Filter: ((a = 4) AND ((a % 2) = 0) AND f_leak(b)) -> Nested Loop Join Filter: (t1_1_2.b = t1_2.b) -> Seq Scan on t3 t1_1_2 Filter: ((a = 4) AND ((a % 2) = 0) AND f_leak(b)) -> Append - -> Seq Scan on t1 t1_2 + -> Seq Scan on t1 t1_2_1 Filter: ((a = 4) AND ((a % 2) = 0) AND f_leak(b)) - -> Seq Scan on t2 t1_2_1 + -> Seq Scan on t2 t1_2_2 Filter: ((a = 4) AND ((a % 2) = 0) AND f_leak(b)) - -> Seq Scan on t3 t1_2_2 + -> Seq Scan on t3 t1_2_3 Filter: ((a = 4) AND ((a % 2) = 0) AND f_leak(b)) (37 rows) diff --git a/src/test/regress/expected/select_parallel.out b/src/test/regress/expected/select_parallel.out index 4d08abc0b8..96dfb7c8dd 100644 --- a/src/test/regress/expected/select_parallel.out +++ b/src/test/regress/expected/select_parallel.out @@ -21,12 +21,12 @@ explain (costs off) Workers Planned: 3 -> Partial Aggregate -> Parallel Append - -> Parallel Seq Scan on d_star a_star_3 - -> Parallel Seq Scan on f_star a_star_5 - -> Parallel Seq Scan on e_star a_star_4 - -> Parallel Seq Scan on b_star a_star_1 - -> Parallel Seq Scan on c_star a_star_2 - -> Parallel Seq Scan on a_star + -> Parallel Seq Scan on d_star a_star_4 + -> Parallel Seq Scan on f_star a_star_6 + -> Parallel Seq Scan on e_star a_star_5 + -> Parallel Seq Scan on b_star a_star_2 + -> Parallel Seq Scan on c_star a_star_3 + -> Parallel Seq Scan on a_star a_star_1 (11 rows) select round(avg(aa)), sum(aa) from a_star a1; @@ -47,12 +47,12 @@ explain (costs off) Workers Planned: 3 -> Partial Aggregate -> Parallel Append - -> Seq Scan on d_star a_star_3 - -> Seq Scan on c_star a_star_2 - -> Parallel Seq Scan on f_star a_star_5 - -> Parallel Seq Scan on e_star a_star_4 - -> Parallel Seq Scan on b_star a_star_1 - -> Parallel Seq Scan on a_star + -> Seq Scan on d_star a_star_4 + -> Seq Scan on c_star a_star_3 + -> Parallel Seq Scan on f_star a_star_6 + -> Parallel Seq Scan on e_star a_star_5 + -> Parallel Seq Scan on b_star a_star_2 + -> Parallel Seq Scan on a_star a_star_1 (11 rows) select round(avg(aa)), sum(aa) from a_star a2; @@ -75,12 +75,12 @@ explain (costs off) Workers Planned: 3 -> Partial Aggregate -> Parallel Append - -> Seq Scan on d_star a_star_3 - -> Seq Scan on f_star a_star_5 - -> Seq Scan on e_star a_star_4 - -> Seq Scan on b_star a_star_1 - -> Seq Scan on c_star a_star_2 - -> Seq Scan on a_star + -> Seq Scan on d_star a_star_4 + -> Seq Scan on f_star a_star_6 + -> Seq Scan on e_star a_star_5 + -> Seq Scan on b_star a_star_2 + -> Seq Scan on c_star a_star_3 + -> Seq Scan on a_star a_star_1 (11 rows) select round(avg(aa)), sum(aa) from a_star a3; @@ -106,12 +106,12 @@ explain (costs off) Workers Planned: 1 -> Partial Aggregate -> Append - -> Parallel Seq Scan on a_star - -> Parallel Seq Scan on b_star a_star_1 - -> Parallel Seq Scan on c_star a_star_2 - -> Parallel Seq Scan on d_star a_star_3 - -> Parallel Seq Scan on e_star a_star_4 - -> Parallel Seq Scan on f_star a_star_5 + -> Parallel Seq Scan on a_star a_star_1 + -> Parallel Seq Scan on b_star a_star_2 + -> Parallel Seq Scan on c_star a_star_3 + -> Parallel Seq Scan on d_star a_star_4 + -> Parallel Seq Scan on e_star a_star_5 + -> Parallel Seq Scan on f_star a_star_6 (11 rows) select round(avg(aa)), sum(aa) from a_star a4; @@ -145,15 +145,15 @@ explain (costs off) -> Gather Workers Planned: 3 -> Parallel Append - -> Parallel Seq Scan on part_pa_test_p1 pa2 - -> Parallel Seq Scan on part_pa_test_p2 pa2_1 + -> Parallel Seq Scan on part_pa_test_p1 pa2_1 + -> Parallel Seq Scan on part_pa_test_p2 pa2_2 SubPlan 2 -> Result SubPlan 1 -> Append - -> Seq Scan on part_pa_test_p1 pa1 + -> Seq Scan on part_pa_test_p1 pa1_1 Filter: (a = pa2.a) - -> Seq Scan on part_pa_test_p2 pa1_1 + -> Seq Scan on part_pa_test_p2 pa1_2 Filter: (a = pa2.a) (14 rows) diff --git a/src/test/regress/expected/tablesample.out b/src/test/regress/expected/tablesample.out index a324220820..078358d226 100644 --- a/src/test/regress/expected/tablesample.out +++ b/src/test/regress/expected/tablesample.out @@ -198,13 +198,13 @@ explain (costs off) ------------------------------------------------- Aggregate -> Append - -> Sample Scan on person + -> Sample Scan on person person_1 Sampling: bernoulli ('100'::real) - -> Sample Scan on emp person_1 + -> Sample Scan on emp person_2 Sampling: bernoulli ('100'::real) - -> Sample Scan on student person_2 + -> Sample Scan on student person_3 Sampling: bernoulli ('100'::real) - -> Sample Scan on stud_emp person_3 + -> Sample Scan on stud_emp person_4 Sampling: bernoulli ('100'::real) (10 rows) @@ -319,12 +319,12 @@ create table parted_sample_1 partition of parted_sample for values in (1); create table parted_sample_2 partition of parted_sample for values in (2); explain (costs off) select * from parted_sample tablesample bernoulli (100); - QUERY PLAN ------------------------------------------------------- + QUERY PLAN +------------------------------------------- Append - -> Sample Scan on parted_sample_1 parted_sample + -> Sample Scan on parted_sample_1 Sampling: bernoulli ('100'::real) - -> Sample Scan on parted_sample_2 parted_sample_1 + -> Sample Scan on parted_sample_2 Sampling: bernoulli ('100'::real) (5 rows) diff --git a/src/test/regress/expected/updatable_views.out b/src/test/regress/expected/updatable_views.out index 9e1dae60de..d54a0a1c2e 100644 --- a/src/test/regress/expected/updatable_views.out +++ b/src/test/regress/expected/updatable_views.out @@ -1548,16 +1548,16 @@ INSERT INTO other_tbl_parent VALUES (7),(200); INSERT INTO other_tbl_child VALUES (8),(100); EXPLAIN (costs off) UPDATE rw_view1 SET a = a + 1000 FROM other_tbl_parent WHERE a = id; - QUERY PLAN ------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------- Update on base_tbl_parent Update on base_tbl_parent Update on base_tbl_child base_tbl_parent_1 -> Hash Join Hash Cond: (other_tbl_parent.id = base_tbl_parent.a) -> Append - -> Seq Scan on other_tbl_parent - -> Seq Scan on other_tbl_child other_tbl_parent_1 + -> Seq Scan on other_tbl_parent other_tbl_parent_1 + -> Seq Scan on other_tbl_child other_tbl_parent_2 -> Hash -> Seq Scan on base_tbl_parent -> Merge Join @@ -1568,8 +1568,8 @@ UPDATE rw_view1 SET a = a + 1000 FROM other_tbl_parent WHERE a = id; -> Sort Sort Key: other_tbl_parent.id -> Append - -> Seq Scan on other_tbl_parent - -> Seq Scan on other_tbl_child other_tbl_parent_1 + -> Seq Scan on other_tbl_parent other_tbl_parent_1 + -> Seq Scan on other_tbl_child other_tbl_parent_2 (20 rows) UPDATE rw_view1 SET a = a + 1000 FROM other_tbl_parent WHERE a = id; @@ -2293,16 +2293,16 @@ UPDATE v1 SET a=100 WHERE snoop(a) AND leakproof(a) AND a < 7 AND a != 6; Filter: ((t1.a <> 6) AND (alternatives: SubPlan 1 or hashed SubPlan 2) AND snoop(t1.a) AND leakproof(t1.a)) SubPlan 1 -> Append - -> Seq Scan on public.t12 - Filter: (t12.a = t1.a) - -> Seq Scan on public.t111 t12_1 + -> Seq Scan on public.t12 t12_1 Filter: (t12_1.a = t1.a) + -> Seq Scan on public.t111 t12_2 + Filter: (t12_2.a = t1.a) SubPlan 2 -> Append - -> Seq Scan on public.t12 t12_2 - Output: t12_2.a - -> Seq Scan on public.t111 t12_3 - Output: t12_3.a + -> Seq Scan on public.t12 t12_4 + Output: t12_4.a + -> Seq Scan on public.t111 t12_5 + Output: t12_5.a -> Index Scan using t11_a_idx on public.t11 t1_1 Output: 100, t1_1.b, t1_1.c, t1_1.d, t1_1.ctid Index Cond: ((t1_1.a > 5) AND (t1_1.a < 7)) @@ -2343,16 +2343,16 @@ UPDATE v1 SET a=a+1 WHERE snoop(a) AND leakproof(a) AND a = 8; Filter: ((alternatives: SubPlan 1 or hashed SubPlan 2) AND snoop(t1.a) AND leakproof(t1.a)) SubPlan 1 -> Append - -> Seq Scan on public.t12 - Filter: (t12.a = t1.a) - -> Seq Scan on public.t111 t12_1 + -> Seq Scan on public.t12 t12_1 Filter: (t12_1.a = t1.a) + -> Seq Scan on public.t111 t12_2 + Filter: (t12_2.a = t1.a) SubPlan 2 -> Append - -> Seq Scan on public.t12 t12_2 - Output: t12_2.a - -> Seq Scan on public.t111 t12_3 - Output: t12_3.a + -> Seq Scan on public.t12 t12_4 + Output: t12_4.a + -> Seq Scan on public.t111 t12_5 + Output: t12_5.a -> Index Scan using t11_a_idx on public.t11 t1_1 Output: (t1_1.a + 1), t1_1.b, t1_1.c, t1_1.d, t1_1.ctid Index Cond: ((t1_1.a > 5) AND (t1_1.a = 8))