PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <math.h>
#include "access/sysattr.h"
#include "catalog/pg_class.h"
#include "foreign/fdwapi.h"
#include "miscadmin.h"
#include "nodes/extensible.h"
#include "nodes/makefuncs.h"
#include "nodes/nodeFuncs.h"
#include "optimizer/clauses.h"
#include "optimizer/cost.h"
#include "optimizer/optimizer.h"
#include "optimizer/paramassign.h"
#include "optimizer/pathnode.h"
#include "optimizer/paths.h"
#include "optimizer/placeholder.h"
#include "optimizer/plancat.h"
#include "optimizer/planmain.h"
#include "optimizer/prep.h"
#include "optimizer/restrictinfo.h"
#include "optimizer/subselect.h"
#include "optimizer/tlist.h"
#include "parser/parse_clause.h"
#include "parser/parsetree.h"
#include "partitioning/partprune.h"
#include "tcop/tcopprot.h"
#include "utils/lsyscache.h"
Go to the source code of this file.
Macros | |
#define | CP_EXACT_TLIST 0x0001 /* Plan must return specified tlist */ |
#define | CP_SMALL_TLIST 0x0002 /* Prefer narrower tlists */ |
#define | CP_LABEL_TLIST 0x0004 /* tlist must contain sortgrouprefs */ |
#define | CP_IGNORE_TLIST 0x0008 /* caller will replace tlist */ |
Functions | |
static Plan * | create_plan_recurse (PlannerInfo *root, Path *best_path, int flags) |
static Plan * | create_scan_plan (PlannerInfo *root, Path *best_path, int flags) |
static List * | build_path_tlist (PlannerInfo *root, Path *path) |
static bool | use_physical_tlist (PlannerInfo *root, Path *path, int flags) |
static List * | get_gating_quals (PlannerInfo *root, List *quals) |
static Plan * | create_gating_plan (PlannerInfo *root, Path *path, Plan *plan, List *gating_quals) |
static Plan * | create_join_plan (PlannerInfo *root, JoinPath *best_path) |
static bool | mark_async_capable_plan (Plan *plan, Path *path) |
static Plan * | create_append_plan (PlannerInfo *root, AppendPath *best_path, int flags) |
static Plan * | create_merge_append_plan (PlannerInfo *root, MergeAppendPath *best_path, int flags) |
static Result * | create_group_result_plan (PlannerInfo *root, GroupResultPath *best_path) |
static ProjectSet * | create_project_set_plan (PlannerInfo *root, ProjectSetPath *best_path) |
static Material * | create_material_plan (PlannerInfo *root, MaterialPath *best_path, int flags) |
static Memoize * | create_memoize_plan (PlannerInfo *root, MemoizePath *best_path, int flags) |
static Plan * | create_unique_plan (PlannerInfo *root, UniquePath *best_path, int flags) |
static Gather * | create_gather_plan (PlannerInfo *root, GatherPath *best_path) |
static Plan * | create_projection_plan (PlannerInfo *root, ProjectionPath *best_path, int flags) |
static Plan * | inject_projection_plan (Plan *subplan, List *tlist, bool parallel_safe) |
static Sort * | create_sort_plan (PlannerInfo *root, SortPath *best_path, int flags) |
static IncrementalSort * | create_incrementalsort_plan (PlannerInfo *root, IncrementalSortPath *best_path, int flags) |
static Group * | create_group_plan (PlannerInfo *root, GroupPath *best_path) |
static Unique * | create_upper_unique_plan (PlannerInfo *root, UpperUniquePath *best_path, int flags) |
static Agg * | create_agg_plan (PlannerInfo *root, AggPath *best_path) |
static Plan * | create_groupingsets_plan (PlannerInfo *root, GroupingSetsPath *best_path) |
static Result * | create_minmaxagg_plan (PlannerInfo *root, MinMaxAggPath *best_path) |
static WindowAgg * | create_windowagg_plan (PlannerInfo *root, WindowAggPath *best_path) |
static SetOp * | create_setop_plan (PlannerInfo *root, SetOpPath *best_path, int flags) |
static RecursiveUnion * | create_recursiveunion_plan (PlannerInfo *root, RecursiveUnionPath *best_path) |
static LockRows * | create_lockrows_plan (PlannerInfo *root, LockRowsPath *best_path, int flags) |
static ModifyTable * | create_modifytable_plan (PlannerInfo *root, ModifyTablePath *best_path) |
static Limit * | create_limit_plan (PlannerInfo *root, LimitPath *best_path, int flags) |
static SeqScan * | create_seqscan_plan (PlannerInfo *root, Path *best_path, List *tlist, List *scan_clauses) |
static SampleScan * | create_samplescan_plan (PlannerInfo *root, Path *best_path, List *tlist, List *scan_clauses) |
static Scan * | create_indexscan_plan (PlannerInfo *root, IndexPath *best_path, List *tlist, List *scan_clauses, bool indexonly) |
static BitmapHeapScan * | create_bitmap_scan_plan (PlannerInfo *root, BitmapHeapPath *best_path, List *tlist, List *scan_clauses) |
static Plan * | create_bitmap_subplan (PlannerInfo *root, Path *bitmapqual, List **qual, List **indexqual, List **indexECs) |
static void | bitmap_subplan_mark_shared (Plan *plan) |
static TidScan * | create_tidscan_plan (PlannerInfo *root, TidPath *best_path, List *tlist, List *scan_clauses) |
static TidRangeScan * | create_tidrangescan_plan (PlannerInfo *root, TidRangePath *best_path, List *tlist, List *scan_clauses) |
static SubqueryScan * | create_subqueryscan_plan (PlannerInfo *root, SubqueryScanPath *best_path, List *tlist, List *scan_clauses) |
static FunctionScan * | create_functionscan_plan (PlannerInfo *root, Path *best_path, List *tlist, List *scan_clauses) |
static ValuesScan * | create_valuesscan_plan (PlannerInfo *root, Path *best_path, List *tlist, List *scan_clauses) |
static TableFuncScan * | create_tablefuncscan_plan (PlannerInfo *root, Path *best_path, List *tlist, List *scan_clauses) |
static CteScan * | create_ctescan_plan (PlannerInfo *root, Path *best_path, List *tlist, List *scan_clauses) |
static NamedTuplestoreScan * | create_namedtuplestorescan_plan (PlannerInfo *root, Path *best_path, List *tlist, List *scan_clauses) |
static Result * | create_resultscan_plan (PlannerInfo *root, Path *best_path, List *tlist, List *scan_clauses) |
static WorkTableScan * | create_worktablescan_plan (PlannerInfo *root, Path *best_path, List *tlist, List *scan_clauses) |
static ForeignScan * | create_foreignscan_plan (PlannerInfo *root, ForeignPath *best_path, List *tlist, List *scan_clauses) |
static CustomScan * | create_customscan_plan (PlannerInfo *root, CustomPath *best_path, List *tlist, List *scan_clauses) |
static NestLoop * | create_nestloop_plan (PlannerInfo *root, NestPath *best_path) |
static MergeJoin * | create_mergejoin_plan (PlannerInfo *root, MergePath *best_path) |
static HashJoin * | create_hashjoin_plan (PlannerInfo *root, HashPath *best_path) |
static Node * | replace_nestloop_params (PlannerInfo *root, Node *expr) |
static Node * | replace_nestloop_params_mutator (Node *node, PlannerInfo *root) |
static void | fix_indexqual_references (PlannerInfo *root, IndexPath *index_path, List **stripped_indexquals_p, List **fixed_indexquals_p) |
static List * | fix_indexorderby_references (PlannerInfo *root, IndexPath *index_path) |
static Node * | fix_indexqual_clause (PlannerInfo *root, IndexOptInfo *index, int indexcol, Node *clause, List *indexcolnos) |
static Node * | fix_indexqual_operand (Node *node, IndexOptInfo *index, int indexcol) |
static List * | get_switched_clauses (List *clauses, Relids outerrelids) |
static List * | order_qual_clauses (PlannerInfo *root, List *clauses) |
static void | copy_generic_path_info (Plan *dest, Path *src) |
static void | copy_plan_costsize (Plan *dest, Plan *src) |
static void | label_sort_with_costsize (PlannerInfo *root, Sort *plan, double limit_tuples) |
static void | label_incrementalsort_with_costsize (PlannerInfo *root, IncrementalSort *plan, List *pathkeys, double limit_tuples) |
static SeqScan * | make_seqscan (List *qptlist, List *qpqual, Index scanrelid) |
static SampleScan * | make_samplescan (List *qptlist, List *qpqual, Index scanrelid, TableSampleClause *tsc) |
static IndexScan * | make_indexscan (List *qptlist, List *qpqual, Index scanrelid, Oid indexid, List *indexqual, List *indexqualorig, List *indexorderby, List *indexorderbyorig, List *indexorderbyops, ScanDirection indexscandir) |
static IndexOnlyScan * | make_indexonlyscan (List *qptlist, List *qpqual, Index scanrelid, Oid indexid, List *indexqual, List *recheckqual, List *indexorderby, List *indextlist, ScanDirection indexscandir) |
static BitmapIndexScan * | make_bitmap_indexscan (Index scanrelid, Oid indexid, List *indexqual, List *indexqualorig) |
static BitmapHeapScan * | make_bitmap_heapscan (List *qptlist, List *qpqual, Plan *lefttree, List *bitmapqualorig, Index scanrelid) |
static TidScan * | make_tidscan (List *qptlist, List *qpqual, Index scanrelid, List *tidquals) |
static TidRangeScan * | make_tidrangescan (List *qptlist, List *qpqual, Index scanrelid, List *tidrangequals) |
static SubqueryScan * | make_subqueryscan (List *qptlist, List *qpqual, Index scanrelid, Plan *subplan) |
static FunctionScan * | make_functionscan (List *qptlist, List *qpqual, Index scanrelid, List *functions, bool funcordinality) |
static ValuesScan * | make_valuesscan (List *qptlist, List *qpqual, Index scanrelid, List *values_lists) |
static TableFuncScan * | make_tablefuncscan (List *qptlist, List *qpqual, Index scanrelid, TableFunc *tablefunc) |
static CteScan * | make_ctescan (List *qptlist, List *qpqual, Index scanrelid, int ctePlanId, int cteParam) |
static NamedTuplestoreScan * | make_namedtuplestorescan (List *qptlist, List *qpqual, Index scanrelid, char *enrname) |
static WorkTableScan * | make_worktablescan (List *qptlist, List *qpqual, Index scanrelid, int wtParam) |
static RecursiveUnion * | make_recursive_union (List *tlist, Plan *lefttree, Plan *righttree, int wtParam, List *distinctList, long numGroups) |
static BitmapAnd * | make_bitmap_and (List *bitmapplans) |
static BitmapOr * | make_bitmap_or (List *bitmapplans) |
static NestLoop * | make_nestloop (List *tlist, List *joinclauses, List *otherclauses, List *nestParams, Plan *lefttree, Plan *righttree, JoinType jointype, bool inner_unique) |
static HashJoin * | make_hashjoin (List *tlist, List *joinclauses, List *otherclauses, List *hashclauses, List *hashoperators, List *hashcollations, List *hashkeys, Plan *lefttree, Plan *righttree, JoinType jointype, bool inner_unique) |
static Hash * | make_hash (Plan *lefttree, List *hashkeys, Oid skewTable, AttrNumber skewColumn, bool skewInherit) |
static MergeJoin * | make_mergejoin (List *tlist, List *joinclauses, List *otherclauses, List *mergeclauses, Oid *mergefamilies, Oid *mergecollations, bool *mergereversals, bool *mergenullsfirst, Plan *lefttree, Plan *righttree, JoinType jointype, bool inner_unique, bool skip_mark_restore) |
static Sort * | make_sort (Plan *lefttree, int numCols, AttrNumber *sortColIdx, Oid *sortOperators, Oid *collations, bool *nullsFirst) |
static IncrementalSort * | make_incrementalsort (Plan *lefttree, int numCols, int nPresortedCols, AttrNumber *sortColIdx, Oid *sortOperators, Oid *collations, bool *nullsFirst) |
static Plan * | prepare_sort_from_pathkeys (Plan *lefttree, List *pathkeys, Relids relids, const AttrNumber *reqColIdx, bool adjust_tlist_in_place, int *p_numsortkeys, AttrNumber **p_sortColIdx, Oid **p_sortOperators, Oid **p_collations, bool **p_nullsFirst) |
static Sort * | make_sort_from_pathkeys (Plan *lefttree, List *pathkeys, Relids relids) |
static IncrementalSort * | make_incrementalsort_from_pathkeys (Plan *lefttree, List *pathkeys, Relids relids, int nPresortedCols) |
static Sort * | make_sort_from_groupcols (List *groupcls, AttrNumber *grpColIdx, Plan *lefttree) |
static Material * | make_material (Plan *lefttree) |
static Memoize * | make_memoize (Plan *lefttree, Oid *hashoperators, Oid *collations, List *param_exprs, bool singlerow, bool binary_mode, uint32 est_entries, Bitmapset *keyparamids) |
static WindowAgg * | make_windowagg (List *tlist, Index winref, int partNumCols, AttrNumber *partColIdx, Oid *partOperators, Oid *partCollations, int ordNumCols, AttrNumber *ordColIdx, Oid *ordOperators, Oid *ordCollations, int frameOptions, Node *startOffset, Node *endOffset, Oid startInRangeFunc, Oid endInRangeFunc, Oid inRangeColl, bool inRangeAsc, bool inRangeNullsFirst, List *runCondition, List *qual, bool topWindow, Plan *lefttree) |
static Group * | make_group (List *tlist, List *qual, int numGroupCols, AttrNumber *grpColIdx, Oid *grpOperators, Oid *grpCollations, Plan *lefttree) |
static Unique * | make_unique_from_sortclauses (Plan *lefttree, List *distinctList) |
static Unique * | make_unique_from_pathkeys (Plan *lefttree, List *pathkeys, int numCols) |
static Gather * | make_gather (List *qptlist, List *qpqual, int nworkers, int rescan_param, bool single_copy, Plan *subplan) |
static SetOp * | make_setop (SetOpCmd cmd, SetOpStrategy strategy, Plan *lefttree, List *distinctList, AttrNumber flagColIdx, int firstFlag, long numGroups) |
static LockRows * | make_lockrows (Plan *lefttree, List *rowMarks, int epqParam) |
static Result * | make_result (List *tlist, Node *resconstantqual, Plan *subplan) |
static ProjectSet * | make_project_set (List *tlist, Plan *subplan) |
static ModifyTable * | make_modifytable (PlannerInfo *root, Plan *subplan, CmdType operation, bool canSetTag, Index nominalRelation, Index rootRelation, bool partColsUpdated, List *resultRelations, List *updateColnosLists, List *withCheckOptionLists, List *returningLists, List *rowMarks, OnConflictExpr *onconflict, List *mergeActionLists, List *mergeJoinConditions, int epqParam) |
static GatherMerge * | create_gather_merge_plan (PlannerInfo *root, GatherMergePath *best_path) |
Plan * | create_plan (PlannerInfo *root, Path *best_path) |
Plan * | change_plan_targetlist (Plan *subplan, List *tlist, bool tlist_parallel_safe) |
static AttrNumber * | remap_groupColIdx (PlannerInfo *root, List *groupClause) |
ForeignScan * | make_foreignscan (List *qptlist, List *qpqual, Index scanrelid, List *fdw_exprs, List *fdw_private, List *fdw_scan_tlist, List *fdw_recheck_quals, Plan *outer_plan) |
Sort * | make_sort_from_sortclauses (List *sortcls, Plan *lefttree) |
Plan * | materialize_finished_plan (Plan *subplan) |
Agg * | make_agg (List *tlist, List *qual, AggStrategy aggstrategy, AggSplit aggsplit, int numGroupCols, AttrNumber *grpColIdx, Oid *grpOperators, Oid *grpCollations, List *groupingSets, List *chain, double dNumGroups, Size transitionSpace, Plan *lefttree) |
Limit * | make_limit (Plan *lefttree, Node *limitOffset, Node *limitCount, LimitOption limitOption, int uniqNumCols, AttrNumber *uniqColIdx, Oid *uniqOperators, Oid *uniqCollations) |
bool | is_projection_capable_path (Path *path) |
bool | is_projection_capable_plan (Plan *plan) |
#define CP_EXACT_TLIST 0x0001 /* Plan must return specified tlist */ |
Definition at line 70 of file createplan.c.
#define CP_IGNORE_TLIST 0x0008 /* caller will replace tlist */ |
Definition at line 73 of file createplan.c.
#define CP_LABEL_TLIST 0x0004 /* tlist must contain sortgrouprefs */ |
Definition at line 72 of file createplan.c.
#define CP_SMALL_TLIST 0x0002 /* Prefer narrower tlists */ |
Definition at line 71 of file createplan.c.
|
static |
Definition at line 5552 of file createplan.c.
References elog, ERROR, IsA, linitial, nodeTag, and plan.
Referenced by create_bitmap_scan_plan().
|
static |
Definition at line 828 of file createplan.c.
References lappend(), lfirst, makeTargetEntry(), NIL, replace_nestloop_params(), TargetEntry::ressortgroupref, and root.
Referenced by create_agg_plan(), create_append_plan(), create_gather_merge_plan(), create_gather_plan(), create_gating_plan(), create_group_plan(), create_group_result_plan(), create_groupingsets_plan(), create_hashjoin_plan(), create_merge_append_plan(), create_mergejoin_plan(), create_minmaxagg_plan(), create_nestloop_plan(), create_project_set_plan(), create_projection_plan(), create_recursiveunion_plan(), create_scan_plan(), create_unique_plan(), and create_windowagg_plan().
Definition at line 2151 of file createplan.c.
References inject_projection_plan(), is_projection_capable_plan(), Plan::parallel_safe, Plan::targetlist, and tlist_same_exprs().
Referenced by create_unique_plan(), and postgresGetForeignPlan().
Definition at line 5453 of file createplan.c.
References generate_unaccent_rules::dest, Path::disabled_nodes, Path::parallel_aware, Path::parallel_safe, Path::rows, Path::startup_cost, and Path::total_cost.
Referenced by create_agg_plan(), create_append_plan(), create_bitmap_scan_plan(), create_ctescan_plan(), create_customscan_plan(), create_foreignscan_plan(), create_functionscan_plan(), create_gather_merge_plan(), create_gather_plan(), create_group_plan(), create_group_result_plan(), create_groupingsets_plan(), create_hashjoin_plan(), create_incrementalsort_plan(), create_indexscan_plan(), create_limit_plan(), create_lockrows_plan(), create_material_plan(), create_memoize_plan(), create_merge_append_plan(), create_mergejoin_plan(), create_minmaxagg_plan(), create_modifytable_plan(), create_namedtuplestorescan_plan(), create_nestloop_plan(), create_project_set_plan(), create_projection_plan(), create_recursiveunion_plan(), create_resultscan_plan(), create_samplescan_plan(), create_seqscan_plan(), create_setop_plan(), create_sort_plan(), create_subqueryscan_plan(), create_tablefuncscan_plan(), create_tidrangescan_plan(), create_tidscan_plan(), create_unique_plan(), create_upper_unique_plan(), create_valuesscan_plan(), create_windowagg_plan(), and create_worktablescan_plan().
Definition at line 5469 of file createplan.c.
References generate_unaccent_rules::dest, Plan::disabled_nodes, Plan::parallel_safe, Plan::plan_rows, Plan::plan_width, Plan::startup_cost, and Plan::total_cost.
Referenced by create_gating_plan(), create_hashjoin_plan(), create_mergejoin_plan(), and inject_projection_plan().
|
static |
Definition at line 2307 of file createplan.c.
References AggPath::aggsplit, AggPath::aggstrategy, build_path_tlist(), copy_generic_path_info(), CP_LABEL_TLIST, create_plan_recurse(), extract_grouping_collations(), extract_grouping_cols(), extract_grouping_ops(), AggPath::groupClause, list_length(), make_agg(), NIL, AggPath::numGroups, order_qual_clauses(), AggPath::path, plan, AggPath::qual, root, AggPath::subpath, Plan::targetlist, and AggPath::transitionSpace.
Referenced by create_plan_recurse().
|
static |
Definition at line 1219 of file createplan.c.
References Assert, Plan::async_capable, RelOptInfo::baserestrictinfo, build_path_tlist(), copy_generic_path_info(), CP_EXACT_TLIST, CP_SMALL_TLIST, create_plan_recurse(), elog, enable_async_append, enable_partition_pruning, ERROR, extract_actual_clauses(), AppendPath::first_partial_path, inject_projection_plan(), label_sort_with_costsize(), lappend(), lfirst, AppendPath::limit_tuples, list_concat(), list_copy_head(), list_length(), list_make1, make_partition_pruneinfo(), make_result(), make_sort(), makeBoolConst(), makeNode, mark_async_capable_plan(), NIL, Path::parallel_safe, AppendPath::path, Path::pathkeys, pathkeys_contained_in(), plan, prepare_sort_from_pathkeys(), RelOptInfo::relids, replace_nestloop_params(), root, sort(), subpath(), and AppendPath::subpaths.
Referenced by create_plan_recurse().
|
static |
Definition at line 3201 of file createplan.c.
References Assert, bitmap_subplan_mark_shared(), BitmapHeapPath::bitmapqual, RestrictInfo::clause, contain_mutable_functions(), copy_generic_path_info(), create_bitmap_subplan(), extract_actual_clauses(), if(), lappend(), lfirst_node, list_difference_ptr(), list_make1, list_member(), list_member_ptr(), make_bitmap_heapscan(), NIL, order_qual_clauses(), Path::parallel_aware, BitmapHeapPath::path, predicate_implied_by(), replace_nestloop_params(), root, RTE_RELATION, and BitmapHeapScan::scan.
Referenced by create_scan_plan().
|
static |
Definition at line 3331 of file createplan.c.
References Assert, BitmapAndPath::bitmapquals, BitmapOrPath::bitmapquals, BitmapAndPath::bitmapselectivity, BitmapOrPath::bitmapselectivity, castNode, clamp_row_est(), RestrictInfo::clause, create_indexscan_plan(), elog, ERROR, get_actual_clauses(), IndexPath::indexclauses, IndexScan::indexid, IndexPath::indexinfo, IndexScan::indexqual, IndexScan::indexqualorig, IndexClause::indexquals, IndexPath::indexselectivity, IndexPath::indextotalcost, IndexOptInfo::indpred, IsA, lappend(), lfirst, linitial, list_concat(), list_concat_unique(), list_length(), list_make1, make_ands_explicit(), make_bitmap_and(), make_bitmap_indexscan(), make_bitmap_or(), make_orclause(), NIL, nodeTag, Path::parallel_safe, IndexPath::path, BitmapAndPath::path, BitmapOrPath::path, plan, predicate_implied_by(), IndexClause::rinfo, root, IndexScan::scan, Scan::scanrelid, Path::startup_cost, and Path::total_cost.
Referenced by create_bitmap_scan_plan().
|
static |
Definition at line 3890 of file createplan.c.
References Assert, copy_generic_path_info(), PlannerInfo::cte_plan_ids, RangeTblEntry::ctelevelsup, Query::cteList, RangeTblEntry::ctename, CommonTableExpr::ctename, elog, ERROR, extract_actual_clauses(), PlannerInfo::init_plans, lfirst, linitial_int, list_length(), list_nth_int(), make_ctescan(), order_qual_clauses(), PlannerInfo::parse, SubPlan::plan_id, planner_rt_fetch, replace_nestloop_params(), root, RTE_CTE, RangeTblEntry::rtekind, CteScan::scan, and SubPlan::setParam.
Referenced by create_scan_plan().
|
static |
Definition at line 4276 of file createplan.c.
References castNode, copy_generic_path_info(), CP_EXACT_TLIST, create_plan_recurse(), CustomScan::custom_exprs, CustomPath::custom_paths, CustomScan::custom_relids, lappend(), lfirst, CustomPath::methods, NIL, order_qual_clauses(), CustomPath::path, plan, CustomPathMethods::PlanCustomPath, replace_nestloop_params(), root, and CustomScan::scan.
Referenced by create_scan_plan().
|
static |
Definition at line 4121 of file createplan.c.
References Assert, RelOptInfo::baserestrictinfo, bms_difference(), bms_free(), bms_is_member(), ForeignScan::checkAsUser, RestrictInfo::clause, copy_generic_path_info(), CP_EXACT_TLIST, create_plan_recurse(), PathTarget::exprs, ForeignScan::fdw_exprs, ForeignPath::fdw_outerpath, ForeignScan::fdw_recheck_quals, FirstLowInvalidHeapAttributeNumber, ForeignScan::fs_base_relids, ForeignScan::fs_relids, ForeignScan::fs_server, ForeignScan::fsSystemCol, i, InvalidOid, lfirst, order_qual_clauses(), ForeignPath::path, planner_rt_fetch, pull_varattnos(), RangeTblEntry::relid, RelOptInfo::relid, RELOPT_UPPER_REL, RelOptInfo::reloptkind, RelOptInfo::reltarget, replace_nestloop_params(), root, RTE_RELATION, RangeTblEntry::rtekind, RelOptInfo::rtekind, ForeignScan::scan, RelOptInfo::serverid, RelOptInfo::userid, and RelOptInfo::useridiscurrent.
Referenced by create_scan_plan().
|
static |
Definition at line 3760 of file createplan.c.
References Assert, copy_generic_path_info(), extract_actual_clauses(), RangeTblEntry::funcordinality, functions, RangeTblEntry::functions, make_functionscan(), order_qual_clauses(), planner_rt_fetch, replace_nestloop_params(), root, RTE_FUNCTION, RangeTblEntry::rtekind, and FunctionScan::scan.
Referenced by create_scan_plan().
|
static |
Definition at line 1961 of file createplan.c.
References Assert, assign_special_exec_param(), build_path_tlist(), copy_generic_path_info(), CP_EXACT_TLIST, create_plan_recurse(), Plan::lefttree, makeNode, NIL, GatherMergePath::num_workers, GatherMerge::num_workers, GatherMerge::numCols, GatherMergePath::path, Path::pathkeys, pathkeys_contained_in(), GatherMerge::plan, prepare_sort_from_pathkeys(), GatherMerge::rescan_param, root, GatherMergePath::subpath, and Plan::targetlist.
Referenced by create_plan_recurse().
|
static |
Definition at line 1923 of file createplan.c.
References assign_special_exec_param(), build_path_tlist(), copy_generic_path_info(), CP_EXACT_TLIST, create_plan_recurse(), make_gather(), NIL, GatherPath::num_workers, GatherPath::path, Gather::plan, root, GatherPath::single_copy, and GatherPath::subpath.
Referenced by create_plan_recurse().
|
static |
Definition at line 1025 of file createplan.c.
References Assert, build_path_tlist(), copy_plan_costsize(), IsA, Plan::lefttree, make_result(), Path::parallel_safe, Plan::parallel_safe, Result::plan, plan, Result::resconstantqual, root, and splan.
Referenced by create_join_plan(), and create_scan_plan().
|
static |
Definition at line 2240 of file createplan.c.
References build_path_tlist(), copy_generic_path_info(), CP_LABEL_TLIST, create_plan_recurse(), extract_grouping_collations(), extract_grouping_cols(), extract_grouping_ops(), GroupPath::groupClause, list_length(), make_group(), order_qual_clauses(), GroupPath::path, plan, GroupPath::qual, root, GroupPath::subpath, and Plan::targetlist.
Referenced by create_plan_recurse().
|
static |
Definition at line 1590 of file createplan.c.
References build_path_tlist(), copy_generic_path_info(), make_result(), order_qual_clauses(), GroupResultPath::path, plan, GroupResultPath::quals, and root.
Referenced by create_plan_recurse().
|
static |
Definition at line 2391 of file createplan.c.
References AGG_HASHED, AGG_PLAIN, AGG_SORTED, AGGSPLIT_SIMPLE, GroupingSetsPath::aggstrategy, Assert, build_path_tlist(), copy_generic_path_info(), CP_LABEL_TLIST, create_plan_recurse(), extract_grouping_collations(), extract_grouping_ops(), for_each_from, get_sortgroupclause_tle(), RollupData::groupClause, RollupData::gsets, RollupData::is_hashed, lappend(), Plan::lefttree, lfirst, linitial, list_length(), make_agg(), make_sort_from_groupcols(), NIL, RollupData::numGroups, palloc0(), GroupingSetsPath::path, plan, GroupingSetsPath::qual, remap_groupColIdx(), TargetEntry::resno, GroupingSetsPath::rollups, root, GroupingSetsPath::subpath, Plan::targetlist, SortGroupClause::tleSortGroupRef, and GroupingSetsPath::transitionSpace.
Referenced by create_plan_recurse().
|
static |
Definition at line 4790 of file createplan.c.
References OpExpr::args, Assert, build_path_tlist(), copy_generic_path_info(), copy_plan_costsize(), CP_SMALL_TLIST, create_plan_recurse(), extract_actual_clauses(), extract_actual_join_clauses(), get_actual_clauses(), get_switched_clauses(), RangeTblEntry::inh, HashPath::inner_rows_total, JoinPath::inner_unique, JoinPath::innerjoinpath, InvalidAttrNumber, InvalidOid, is_opclause(), IS_OUTER_JOIN, IsA, HashJoin::join, JoinPath::joinrestrictinfo, JoinPath::jointype, HashPath::jpath, lappend(), lappend_oid(), lfirst_node, linitial, list_difference(), list_length(), lsecond, make_hash(), make_hashjoin(), NIL, HashPath::num_batches, OpExpr::opno, order_qual_clauses(), JoinPath::outerjoinpath, Plan::parallel_aware, HashPath::path_hashclauses, Hash::plan, RangeTblEntry::relid, replace_nestloop_params(), root, Hash::rows_total, RTE_RELATION, RangeTblEntry::rtekind, Plan::startup_cost, Plan::total_cost, Var::varattno, and Var::varno.
Referenced by create_join_plan().
|
static |
Definition at line 2213 of file createplan.c.
References copy_generic_path_info(), CP_SMALL_TLIST, create_plan_recurse(), IS_OTHER_REL, make_incrementalsort_from_pathkeys(), IncrementalSortPath::nPresortedCols, SortPath::path, Path::pathkeys, plan, root, IncrementalSortPath::spath, and SortPath::subpath.
Referenced by create_plan_recurse().
|
static |
Definition at line 3005 of file createplan.c.
References Assert, BackwardScanDirection, RestrictInfo::clause, contain_mutable_functions(), copy_generic_path_info(), elog, ERROR, exprType(), extract_actual_clauses(), fix_indexorderby_references(), fix_indexqual_references(), forboth, ForwardScanDirection, get_opfamily_member(), i, IndexPath::indexclauses, IndexPath::indexinfo, IndexOptInfo::indexoid, IndexPath::indexorderbys, IndexPath::indexscandir, IndexOptInfo::indextlist, is_redundant_with_indexclauses(), lappend(), lappend_oid(), lfirst, lfirst_node, list_length(), list_make1, make_indexonlyscan(), make_indexscan(), NIL, OidIsValid, order_qual_clauses(), IndexPath::path, Path::pathkeys, PathKey::pk_opfamily, PathKey::pk_strategy, predicate_implied_by(), replace_nestloop_params(), root, and RTE_RELATION.
Referenced by create_bitmap_subplan(), and create_scan_plan().
|
static |
Definition at line 1084 of file createplan.c.
References create_gating_plan(), create_hashjoin_plan(), create_mergejoin_plan(), create_nestloop_plan(), elog, ERROR, get_actual_clauses(), get_gating_quals(), JoinPath::joinrestrictinfo, list_concat(), NIL, plan, and root.
Referenced by create_plan_recurse().
|
static |
Definition at line 2855 of file createplan.c.
References copy_generic_path_info(), create_plan_recurse(), SortGroupClause::eqop, TargetEntry::expr, exprCollation(), get_sortgroupclause_tle(), lfirst, LIMIT_OPTION_WITH_TIES, LimitPath::limitCount, LimitPath::limitOffset, LimitPath::limitOption, list_length(), make_limit(), palloc(), parse(), plan, TargetEntry::resno, root, and LimitPath::subpath.
Referenced by create_plan_recurse().
|
static |
Definition at line 2791 of file createplan.c.
References copy_generic_path_info(), create_plan_recurse(), LockRowsPath::epqParam, make_lockrows(), plan, root, LockRowsPath::rowMarks, and LockRowsPath::subpath.
Referenced by create_plan_recurse().
|
static |
Definition at line 1641 of file createplan.c.
References copy_generic_path_info(), CP_SMALL_TLIST, create_plan_recurse(), make_material(), plan, root, and MaterialPath::subpath.
Referenced by create_plan_recurse().
|
static |
Definition at line 1669 of file createplan.c.
References Assert, MemoizePath::binary_mode, copy_generic_path_info(), CP_SMALL_TLIST, create_plan_recurse(), MemoizePath::est_entries, exprCollation(), forboth, MemoizePath::hash_operators, i, lfirst, lfirst_oid, list_length(), make_memoize(), NIL, palloc(), MemoizePath::param_exprs, plan, pull_paramids(), replace_nestloop_params(), root, MemoizePath::singlerow, and MemoizePath::subpath.
Referenced by create_plan_recurse().
|
static |
Definition at line 1440 of file createplan.c.
References MergeAppend::apprelids, Assert, RelOptInfo::baserestrictinfo, build_path_tlist(), copy_generic_path_info(), CP_EXACT_TLIST, CP_SMALL_TLIST, create_plan_recurse(), elog, enable_partition_pruning, ERROR, extract_actual_clauses(), inject_projection_plan(), label_sort_with_costsize(), lappend(), lfirst, MergeAppendPath::limit_tuples, list_copy_head(), list_length(), make_partition_pruneinfo(), make_sort(), makeNode, MergeAppend::mergeplans, NIL, MergeAppend::numCols, MergeAppend::part_prune_info, MergeAppendPath::path, Path::pathkeys, pathkeys_contained_in(), MergeAppend::plan, plan, prepare_sort_from_pathkeys(), RelOptInfo::relids, root, sort(), subpath(), and MergeAppendPath::subpaths.
Referenced by create_plan_recurse().
|
static |
Definition at line 4439 of file createplan.c.
References Assert, BTGreaterStrategyNumber, build_path_tlist(), copy_generic_path_info(), copy_plan_costsize(), CP_SMALL_TLIST, cpu_operator_cost, create_plan_recurse(), elog, enable_incremental_sort, ERROR, extract_actual_clauses(), extract_actual_join_clauses(), get_actual_clauses(), get_switched_clauses(), i, JoinPath::inner_unique, JoinPath::innerjoinpath, MergePath::innersortkeys, IS_OUTER_JOIN, MergeJoin::join, JoinPath::joinrestrictinfo, JoinPath::jointype, MergePath::jpath, label_incrementalsort_with_costsize(), label_sort_with_costsize(), lfirst, lfirst_node, list_difference(), list_head(), list_length(), lnext(), make_incrementalsort_from_pathkeys(), make_material(), make_mergejoin(), make_sort_from_pathkeys(), MergePath::materialize_inner, NIL, order_qual_clauses(), JoinPath::outerjoinpath, MergePath::outersortkeys, palloc(), MergePath::path_mergeclauses, Path::pathkeys, pathkeys_count_contained_in(), PG_USED_FOR_ASSERTS_ONLY, PathKey::pk_nulls_first, PathKey::pk_opfamily, PathKey::pk_strategy, Plan::plan_rows, replace_nestloop_params(), root, MergePath::skip_mark_restore, sort(), Plan::total_cost, and true.
Referenced by create_join_plan().
|
static |
Definition at line 2549 of file createplan.c.
References Assert, build_path_tlist(), copy_generic_path_info(), create_plan(), Path::disabled_nodes, lfirst, Query::limitCount, Query::limitOffset, Query::limitOption, make_limit(), make_result(), MinMaxAggPath::mmaggregates, NIL, Path::parallel_safe, MinMaxAggInfo::param, PlannerInfo::parse, MinMaxAggPath::path, MinMaxAggInfo::path, MinMaxAggInfo::pathcost, plan, MinMaxAggPath::quals, root, SS_make_initplan_from_plan(), and Path::startup_cost.
Referenced by create_plan_recurse().
|
static |
Definition at line 2814 of file createplan.c.
References apply_tlist_labeling(), ModifyTablePath::canSetTag, copy_generic_path_info(), CP_EXACT_TLIST, create_plan_recurse(), ModifyTablePath::epqParam, make_modifytable(), ModifyTablePath::mergeActionLists, ModifyTablePath::mergeJoinConditions, ModifyTablePath::nominalRelation, ModifyTablePath::onconflict, ModifyTablePath::operation, ModifyTablePath::partColsUpdated, ModifyTablePath::path, plan, ModifyTablePath::resultRelations, ModifyTablePath::returningLists, root, ModifyTablePath::rootRelation, ModifyTablePath::rowMarks, subpath(), ModifyTablePath::subpath, Plan::targetlist, ModifyTablePath::updateColnosLists, and ModifyTablePath::withCheckOptionLists.
Referenced by create_plan_recurse().
|
static |
Definition at line 3985 of file createplan.c.
References Assert, copy_generic_path_info(), RangeTblEntry::enrname, extract_actual_clauses(), make_namedtuplestorescan(), order_qual_clauses(), planner_rt_fetch, replace_nestloop_params(), root, RTE_NAMEDTUPLESTORE, RangeTblEntry::rtekind, and NamedTuplestoreScan::scan.
Referenced by create_scan_plan().
|
static |
Definition at line 4347 of file createplan.c.
References Assert, bms_free(), bms_union(), build_path_tlist(), copy_generic_path_info(), create_plan_recurse(), extract_actual_clauses(), extract_actual_join_clauses(), identify_current_nestloop_params(), JoinPath::inner_unique, JoinPath::innerjoinpath, IS_OUTER_JOIN, NestLoop::join, JoinPath::joinrestrictinfo, JoinPath::jointype, NestPath::jpath, make_nestloop(), NIL, order_qual_clauses(), JoinPath::outerjoinpath, reparameterize_path_by_child(), replace_nestloop_params(), and root.
Referenced by create_join_plan().
Plan* create_plan | ( | PlannerInfo * | root, |
Path * | best_path | ||
) |
Definition at line 340 of file createplan.c.
References apply_tlist_labeling(), Assert, CP_EXACT_TLIST, create_plan_recurse(), elog, ERROR, IsA, NIL, plan, root, and SS_attach_initplans().
Referenced by create_minmaxagg_plan(), create_subqueryscan_plan(), make_subplan(), SS_process_ctes(), and standard_planner().
|
static |
Definition at line 391 of file createplan.c.
References Assert, check_stack_depth(), create_agg_plan(), create_append_plan(), create_gather_merge_plan(), create_gather_plan(), create_group_plan(), create_group_result_plan(), create_groupingsets_plan(), create_incrementalsort_plan(), create_join_plan(), create_limit_plan(), create_lockrows_plan(), create_material_plan(), create_memoize_plan(), create_merge_append_plan(), create_minmaxagg_plan(), create_modifytable_plan(), create_project_set_plan(), create_projection_plan(), create_recursiveunion_plan(), create_scan_plan(), create_setop_plan(), create_sort_plan(), create_unique_plan(), create_upper_unique_plan(), create_windowagg_plan(), elog, ERROR, IsA, Path::pathtype, plan, and root.
Referenced by create_agg_plan(), create_append_plan(), create_customscan_plan(), create_foreignscan_plan(), create_gather_merge_plan(), create_gather_plan(), create_group_plan(), create_groupingsets_plan(), create_hashjoin_plan(), create_incrementalsort_plan(), create_limit_plan(), create_lockrows_plan(), create_material_plan(), create_memoize_plan(), create_merge_append_plan(), create_mergejoin_plan(), create_modifytable_plan(), create_nestloop_plan(), create_plan(), create_project_set_plan(), create_projection_plan(), create_recursiveunion_plan(), create_setop_plan(), create_sort_plan(), create_unique_plan(), create_upper_unique_plan(), and create_windowagg_plan().
|
static |
Definition at line 1615 of file createplan.c.
References build_path_tlist(), copy_generic_path_info(), create_plan_recurse(), make_project_set(), ProjectSetPath::path, plan, root, and ProjectSetPath::subpath.
Referenced by create_plan_recurse().
|
static |
Definition at line 2017 of file createplan.c.
References apply_pathtarget_labeling_to_tlist(), Assert, build_path_tlist(), copy_generic_path_info(), CP_IGNORE_TLIST, CP_LABEL_TLIST, create_plan_recurse(), is_projection_capable_path(), is_projection_capable_plan(), make_result(), Path::parallel_safe, ProjectionPath::path, plan, root, Path::rows, Path::startup_cost, ProjectionPath::subpath, Plan::targetlist, tlist_same_exprs(), Path::total_cost, and use_physical_tlist().
Referenced by create_plan_recurse().
|
static |
Definition at line 2755 of file createplan.c.
References build_path_tlist(), clamp_cardinality_to_long(), copy_generic_path_info(), CP_EXACT_TLIST, create_plan_recurse(), RecursiveUnionPath::distinctList, RecursiveUnionPath::leftpath, make_recursive_union(), RecursiveUnionPath::numGroups, RecursiveUnionPath::path, plan, RecursiveUnionPath::rightpath, root, and RecursiveUnionPath::wtParam.
Referenced by create_plan_recurse().
|
static |
Definition at line 4024 of file createplan.c.
References Assert, copy_generic_path_info(), extract_actual_clauses(), make_result(), order_qual_clauses(), PG_USED_FOR_ASSERTS_ONLY, Result::plan, planner_rt_fetch, replace_nestloop_params(), root, and RTE_RESULT.
Referenced by create_scan_plan().
|
static |
Definition at line 2954 of file createplan.c.
References Assert, copy_generic_path_info(), extract_actual_clauses(), make_samplescan(), order_qual_clauses(), planner_rt_fetch, replace_nestloop_params(), root, RTE_RELATION, RangeTblEntry::rtekind, SampleScan::scan, and RangeTblEntry::tablesample.
Referenced by create_scan_plan().
|
static |
Definition at line 562 of file createplan.c.
References apply_pathtarget_labeling_to_tlist(), Assert, RelOptInfo::baserestrictinfo, build_path_tlist(), build_physical_tlist(), castNode, copyObject, CP_IGNORE_TLIST, CP_LABEL_TLIST, create_bitmap_scan_plan(), create_ctescan_plan(), create_customscan_plan(), create_foreignscan_plan(), create_functionscan_plan(), create_gating_plan(), create_indexscan_plan(), create_namedtuplestorescan_plan(), create_resultscan_plan(), create_samplescan_plan(), create_seqscan_plan(), create_subqueryscan_plan(), create_tablefuncscan_plan(), create_tidrangescan_plan(), create_tidscan_plan(), create_valuesscan_plan(), create_worktablescan_plan(), elog, ERROR, get_gating_quals(), IS_JOIN_REL, list_concat_copy(), NIL, Path::pathtype, plan, root, and use_physical_tlist().
Referenced by create_plan_recurse().
|
static |
Definition at line 2916 of file createplan.c.
References Assert, copy_generic_path_info(), extract_actual_clauses(), make_seqscan(), order_qual_clauses(), replace_nestloop_params(), root, RTE_RELATION, and SeqScan::scan.
Referenced by create_scan_plan().
|
static |
Definition at line 2719 of file createplan.c.