39#define PATH_PARAM_BY_PARENT(path, rel) \
40 ((path)->param_info && bms_overlap(PATH_REQ_OUTER(path), \
41 (rel)->top_parent_relids))
42#define PATH_PARAM_BY_REL_SELF(path, rel) \
43 ((path)->param_info && bms_overlap(PATH_REQ_OUTER(path), (rel)->relids))
45#define PATH_PARAM_BY_REL(path, rel) \
46 (PATH_PARAM_BY_REL_SELF(path, rel) || PATH_PARAM_BY_PARENT(path, rel))
257 jointype, sjinfo, restrictlist,
274 foreach(
lc,
root->join_info_list)
363 joinrel->fdwroutine->GetForeignJoinPaths)
364 joinrel->fdwroutine->GetForeignJoinPaths(
root, joinrel,
425#ifdef USE_ASSERT_CHECKING
439 foreach(
lc,
root->join_info_list)
479 List **operators,
bool *binary_mode)
487 *binary_mode =
false;
516 if (rinfo->outer_is_left)
543 *param_exprs =
lappend(*param_exprs, expr);
564 foreach(
lc, lateral_vars)
596 *param_exprs =
lappend(*param_exprs, expr);
627 if (!
root->hasLateralRTEs)
637 foreach(
lc,
root->placeholder_list)
718 List *hash_operators;
801 ppi_serials =
inner_path->param_info->ppi_serials;
846 outerrel->top_parent ?
847 outerrel->top_parent : outerrel,
917 outerrelids = outerrel->
relids;
1027 outerrelids = outerrel->
relids;
1080 List *outersortkeys,
1081 List *innersortkeys,
1087 int outer_presorted_keys = 0;
1140 if (outersortkeys &&
1142 &outer_presorted_keys))
1143 outersortkeys =
NIL;
1144 if (innersortkeys &&
1146 innersortkeys =
NIL;
1153 outersortkeys, innersortkeys,
1154 outer_presorted_keys,
1175 outer_presorted_keys));
1196 List *outersortkeys,
1197 List *innersortkeys,
1201 int outer_presorted_keys = 0;
1222 if (outersortkeys &&
1224 &outer_presorted_keys))
1225 outersortkeys =
NIL;
1226 if (innersortkeys &&
1228 innersortkeys =
NIL;
1235 outersortkeys, innersortkeys,
1236 outer_presorted_keys,
1258 outer_presorted_keys));
1598 List *innersortkeys;
1620 if (mergeclauses ==
NIL)
1869 elog(
ERROR,
"unrecognized join type: %d",
2340 hashclauses, jointype, extra,
2366 hashclauses, jointype, extra,
2418 foreach(l, restrictlist)
bool innerrel_is_unique(PlannerInfo *root, Relids joinrelids, Relids outerrelids, RelOptInfo *innerrel, JoinType jointype, List *restrictlist, bool force_cache)
Bitmapset * bms_difference(const Bitmapset *a, const Bitmapset *b)
Bitmapset * bms_intersect(const Bitmapset *a, const Bitmapset *b)
bool bms_equal(const Bitmapset *a, const Bitmapset *b)
bool bms_is_subset(const Bitmapset *a, const Bitmapset *b)
void bms_free(Bitmapset *a)
bool bms_is_member(int x, const Bitmapset *a)
Bitmapset * bms_add_members(Bitmapset *a, const Bitmapset *b)
BMS_Membership bms_membership(const Bitmapset *a)
bool bms_overlap(const Bitmapset *a, const Bitmapset *b)
Bitmapset * bms_join(Bitmapset *a, Bitmapset *b)
bool bms_nonempty_difference(const Bitmapset *a, const Bitmapset *b)
#define Assert(condition)
#define OidIsValid(objectId)
bool contain_volatile_functions(Node *clause)
void compute_semi_anti_join_factors(PlannerInfo *root, RelOptInfo *joinrel, RelOptInfo *outerrel, RelOptInfo *innerrel, JoinType jointype, SpecialJoinInfo *sjinfo, List *restrictlist, SemiAntiJoinFactors *semifactors)
void initial_cost_nestloop(PlannerInfo *root, JoinCostWorkspace *workspace, JoinType jointype, uint64 enable_mask, Path *outer_path, Path *inner_path, JoinPathExtraData *extra)
void initial_cost_hashjoin(PlannerInfo *root, JoinCostWorkspace *workspace, JoinType jointype, List *hashclauses, Path *outer_path, Path *inner_path, JoinPathExtraData *extra, bool parallel_hash)
void initial_cost_mergejoin(PlannerInfo *root, JoinCostWorkspace *workspace, JoinType jointype, List *mergeclauses, Path *outer_path, Path *inner_path, List *outersortkeys, List *innersortkeys, int outer_presorted_keys, JoinPathExtraData *extra)
bool enable_parallel_hash
bool ExecMaterializesOutput(NodeTag plantype)
static void try_hashjoin_path(PlannerInfo *root, RelOptInfo *joinrel, Path *outer_path, Path *inner_path, List *hashclauses, JoinType jointype, JoinPathExtraData *extra)
static List * select_mergejoin_clauses(PlannerInfo *root, RelOptInfo *joinrel, RelOptInfo *outerrel, RelOptInfo *innerrel, List *restrictlist, JoinType jointype, bool *mergejoin_allowed)
static void sort_inner_and_outer(PlannerInfo *root, RelOptInfo *joinrel, RelOptInfo *outerrel, RelOptInfo *innerrel, JoinType jointype, JoinPathExtraData *extra)
static List * extract_lateral_vars_from_PHVs(PlannerInfo *root, Relids innerrelids)
void add_paths_to_joinrel(PlannerInfo *root, RelOptInfo *joinrel, RelOptInfo *outerrel, RelOptInfo *innerrel, JoinType jointype, SpecialJoinInfo *sjinfo, List *restrictlist)
static bool paraminfo_get_equal_hashops(PlannerInfo *root, ParamPathInfo *param_info, RelOptInfo *outerrel, RelOptInfo *innerrel, List *ph_lateral_vars, List **param_exprs, List **operators, bool *binary_mode)
static Path * get_memoize_path(PlannerInfo *root, RelOptInfo *innerrel, RelOptInfo *outerrel, Path *inner_path, Path *outer_path, JoinType jointype, JoinPathExtraData *extra)
static void consider_parallel_nestloop(PlannerInfo *root, RelOptInfo *joinrel, RelOptInfo *outerrel, RelOptInfo *innerrel, JoinType jointype, JoinPathExtraData *extra)
join_path_setup_hook_type join_path_setup_hook
#define PATH_PARAM_BY_PARENT(path, rel)
set_join_pathlist_hook_type set_join_pathlist_hook
static void try_nestloop_path(PlannerInfo *root, RelOptInfo *joinrel, Path *outer_path, Path *inner_path, List *pathkeys, JoinType jointype, uint64 nestloop_subtype, JoinPathExtraData *extra)
static void try_mergejoin_path(PlannerInfo *root, RelOptInfo *joinrel, Path *outer_path, Path *inner_path, List *pathkeys, List *mergeclauses, List *outersortkeys, List *innersortkeys, JoinType jointype, JoinPathExtraData *extra, bool is_partial)
static void consider_parallel_mergejoin(PlannerInfo *root, RelOptInfo *joinrel, RelOptInfo *outerrel, RelOptInfo *innerrel, JoinType jointype, JoinPathExtraData *extra, Path *inner_cheapest_total)
static void generate_mergejoin_paths(PlannerInfo *root, RelOptInfo *joinrel, RelOptInfo *innerrel, Path *outerpath, JoinType jointype, JoinPathExtraData *extra, bool useallclauses, Path *inner_cheapest_total, List *merge_pathkeys, bool is_partial)
static void try_partial_nestloop_path(PlannerInfo *root, RelOptInfo *joinrel, Path *outer_path, Path *inner_path, List *pathkeys, JoinType jointype, uint64 nestloop_subtype, JoinPathExtraData *extra)
static void hash_inner_and_outer(PlannerInfo *root, RelOptInfo *joinrel, RelOptInfo *outerrel, RelOptInfo *innerrel, JoinType jointype, JoinPathExtraData *extra)
static void try_partial_mergejoin_path(PlannerInfo *root, RelOptInfo *joinrel, Path *outer_path, Path *inner_path, List *pathkeys, List *mergeclauses, List *outersortkeys, List *innersortkeys, JoinType jointype, JoinPathExtraData *extra)
#define PATH_PARAM_BY_REL(path, rel)
static bool allow_star_schema_join(PlannerInfo *root, Relids outerrelids, Relids inner_paramrels)
static void try_partial_hashjoin_path(PlannerInfo *root, RelOptInfo *joinrel, Path *outer_path, Path *inner_path, List *hashclauses, JoinType jointype, JoinPathExtraData *extra, bool parallel_hash)
static void match_unsorted_outer(PlannerInfo *root, RelOptInfo *joinrel, RelOptInfo *outerrel, RelOptInfo *innerrel, JoinType jointype, JoinPathExtraData *extra)
List * lappend(List *list, void *datum)
List * list_delete_nth_cell(List *list, int n)
List * list_concat(List *list1, const List *list2)
List * list_copy(const List *oldlist)
List * lappend_oid(List *list, Oid datum)
List * lcons(void *datum, List *list)
void list_free(List *list)
List * list_truncate(List *list, int new_size)
bool list_member(const List *list, const void *datum)
Oid get_commutator(Oid opno)
Oid exprType(const Node *expr)
#define IsA(nodeptr, _type_)
#define IS_OUTER_JOIN(jointype)
#define castNode(_type_, nodeptr)
Path * get_cheapest_path_for_pathkeys(List *paths, List *pathkeys, Relids required_outer, CostSelector cost_criterion, bool require_parallel_safe)
bool pathkeys_count_contained_in(List *keys1, List *keys2, int *n_common)
List * make_inner_pathkeys_for_merge(PlannerInfo *root, List *mergeclauses, List *outer_pathkeys)
List * find_mergeclauses_for_outer_pathkeys(PlannerInfo *root, List *pathkeys, List *restrictinfos)
void update_mergeclause_eclasses(PlannerInfo *root, RestrictInfo *restrictinfo)
List * trim_mergeclauses_for_inner_pathkeys(PlannerInfo *root, List *mergeclauses, List *pathkeys)
List * select_outer_pathkeys_for_merge(PlannerInfo *root, List *mergeclauses, RelOptInfo *joinrel)
bool pathkeys_contained_in(List *keys1, List *keys2)
List * build_join_pathkeys(PlannerInfo *root, RelOptInfo *joinrel, JoinType jointype, List *outer_pathkeys)
Path * get_cheapest_parallel_safe_total_inner(List *paths)
Relids calc_non_nestloop_required_outer(Path *outer_path, Path *inner_path)
bool path_is_reparameterizable_by_child(Path *path, RelOptInfo *child_rel)
MemoizePath * create_memoize_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, List *param_exprs, List *hash_operators, bool singlerow, bool binary_mode, Cardinality est_calls)
MaterialPath * create_material_path(RelOptInfo *rel, Path *subpath, bool enabled)
Relids calc_nestloop_required_outer(Relids outerrelids, Relids outer_paramrels, Relids innerrelids, Relids inner_paramrels)
HashPath * create_hashjoin_path(PlannerInfo *root, RelOptInfo *joinrel, JoinType jointype, JoinCostWorkspace *workspace, JoinPathExtraData *extra, Path *outer_path, Path *inner_path, bool parallel_hash, List *restrict_clauses, Relids required_outer, List *hashclauses)
void add_partial_path(RelOptInfo *parent_rel, Path *new_path)
void add_path(RelOptInfo *parent_rel, Path *new_path)
int compare_path_costs(Path *path1, Path *path2, CostSelector criterion)
bool add_path_precheck(RelOptInfo *parent_rel, int disabled_nodes, Cost startup_cost, Cost total_cost, List *pathkeys, Relids required_outer)
bool add_partial_path_precheck(RelOptInfo *parent_rel, int disabled_nodes, Cost total_cost, List *pathkeys)
MergePath * create_mergejoin_path(PlannerInfo *root, RelOptInfo *joinrel, JoinType jointype, JoinCostWorkspace *workspace, JoinPathExtraData *extra, Path *outer_path, Path *inner_path, List *restrict_clauses, List *pathkeys, Relids required_outer, List *mergeclauses, List *outersortkeys, List *innersortkeys, int outer_presorted_keys)
NestPath * create_nestloop_path(PlannerInfo *root, RelOptInfo *joinrel, JoinType jointype, JoinCostWorkspace *workspace, JoinPathExtraData *extra, Path *outer_path, Path *inner_path, List *restrict_clauses, List *pathkeys, Relids required_outer)
#define PGS_NESTLOOP_MEMOIZE
#define EC_MUST_BE_REDUNDANT(eclass)
#define RINFO_IS_PUSHED_DOWN(rinfo, joinrelids)
#define PGS_NESTLOOP_MATERIALIZE
#define PGS_CONSIDER_NONPARTIAL
#define PATH_REQ_OUTER(path)
#define PGS_MERGEJOIN_ANY
#define RELATION_WAS_MADE_UNIQUE(rel, sjinfo, nominal_jointype)
#define PGS_NESTLOOP_PLAIN
void(* join_path_setup_hook_type)(PlannerInfo *root, RelOptInfo *joinrel, RelOptInfo *outerrel, RelOptInfo *innerrel, JoinType jointype, JoinPathExtraData *extra)
void(* set_join_pathlist_hook_type)(PlannerInfo *root, RelOptInfo *joinrel, RelOptInfo *outerrel, RelOptInfo *innerrel, JoinType jointype, JoinPathExtraData *extra)
static int list_length(const List *l)
#define foreach_current_index(var_or_cell)
#define foreach_node(type, var, lst)
static ListCell * list_head(const List *l)
PlaceHolderInfo * find_placeholder_info(PlannerInfo *root, PlaceHolderVar *phv)
static bool clause_sides_match_join(RestrictInfo *rinfo, Relids outerrelids, Relids innerrelids)
struct PathTarget * reltarget
List * cheapest_parameterized_paths
struct Path * cheapest_startup_path
struct Path * cheapest_total_path
TypeCacheEntry * lookup_type_cache(Oid type_id, int flags)
#define TYPECACHE_HASH_PROC
Relids pull_varnos(PlannerInfo *root, Node *node)
List * pull_vars_of_level(Node *node, int levelsup)