PostgreSQL Source Code
git master
|
#include "nodes/pathnodes.h"
Go to the source code of this file.
Typedefs | |
typedef void(* | set_rel_pathlist_hook_type) (PlannerInfo *root, RelOptInfo *rel, Index rti, RangeTblEntry *rte) |
typedef void(* | set_join_pathlist_hook_type) (PlannerInfo *root, RelOptInfo *joinrel, RelOptInfo *outerrel, RelOptInfo *innerrel, JoinType jointype, JoinPathExtraData *extra) |
typedef RelOptInfo *(* | join_search_hook_type) (PlannerInfo *root, int levels_needed, List *initial_rels) |
typedef bool(* | ec_matches_callback_type) (PlannerInfo *root, RelOptInfo *rel, EquivalenceClass *ec, EquivalenceMember *em, void *arg) |
Enumerations | |
enum | PathKeysComparison { PATHKEYS_EQUAL , PATHKEYS_BETTER1 , PATHKEYS_BETTER2 , PATHKEYS_DIFFERENT } |
typedef bool(* ec_matches_callback_type) (PlannerInfo *root, RelOptInfo *rel, EquivalenceClass *ec, EquivalenceMember *em, void *arg) |
typedef RelOptInfo*(* join_search_hook_type) (PlannerInfo *root, int levels_needed, List *initial_rels) |
typedef void(* set_join_pathlist_hook_type) (PlannerInfo *root, RelOptInfo *joinrel, RelOptInfo *outerrel, RelOptInfo *innerrel, JoinType jointype, JoinPathExtraData *extra) |
typedef void(* set_rel_pathlist_hook_type) (PlannerInfo *root, RelOptInfo *rel, Index rti, RangeTblEntry *rte) |
enum PathKeysComparison |
void add_child_join_rel_equivalences | ( | PlannerInfo * | root, |
int | nappinfos, | ||
AppendRelInfo ** | appinfos, | ||
RelOptInfo * | parent_joinrel, | ||
RelOptInfo * | child_joinrel | ||
) |
Definition at line 2812 of file equivclass.c.
References add_eq_member(), adjust_appendrel_attrs(), adjust_appendrel_attrs_multilevel(), Assert, bms_add_members(), bms_difference(), bms_membership(), BMS_MULTIPLE, bms_next_member(), bms_overlap(), EquivalenceClass::ec_has_volatile, EquivalenceClass::ec_members, EquivalenceClass::ec_relids, EquivalenceMember::em_datatype, EquivalenceMember::em_expr, EquivalenceMember::em_is_child, EquivalenceMember::em_is_const, EquivalenceMember::em_jdomain, EquivalenceMember::em_relids, get_eclass_indexes_for_relids(), i, IS_JOIN_REL, list_length(), list_nth(), MemoryContextSwitchTo(), RelOptInfo::relids, RELOPT_JOINREL, RELOPT_OTHER_JOINREL, RelOptInfo::reloptkind, root, and RelOptInfo::top_parent_relids.
Referenced by build_child_join_rel().
void add_child_rel_equivalences | ( | PlannerInfo * | root, |
AppendRelInfo * | appinfo, | ||
RelOptInfo * | parent_rel, | ||
RelOptInfo * | child_rel | ||
) |
Definition at line 2690 of file equivclass.c.
References add_eq_member(), adjust_appendrel_attrs(), adjust_appendrel_attrs_multilevel(), Assert, bms_add_member(), bms_add_members(), bms_difference(), bms_is_empty, bms_is_subset(), bms_next_member(), EquivalenceClass::ec_has_volatile, EquivalenceClass::ec_members, EquivalenceClass::ec_relids, RelOptInfo::eclass_indexes, EquivalenceMember::em_datatype, EquivalenceMember::em_expr, EquivalenceMember::em_is_child, EquivalenceMember::em_is_const, EquivalenceMember::em_jdomain, EquivalenceMember::em_relids, i, IS_SIMPLE_REL, list_length(), list_nth(), RelOptInfo::relids, RELOPT_BASEREL, RelOptInfo::reloptkind, root, and RelOptInfo::top_parent_relids.
Referenced by set_append_rel_size().
Relids add_outer_joins_to_relids | ( | PlannerInfo * | root, |
Relids | input_relids, | ||
SpecialJoinInfo * | sjinfo, | ||
List ** | pushed_down_joins | ||
) |
Definition at line 801 of file joinrels.c.
References bms_add_member(), bms_add_members(), bms_copy(), bms_is_member(), bms_is_subset(), SpecialJoinInfo::commute_above_l, SpecialJoinInfo::commute_below_l, JOIN_LEFT, SpecialJoinInfo::jointype, lappend(), lfirst, SpecialJoinInfo::min_lefthand, SpecialJoinInfo::min_righthand, SpecialJoinInfo::ojrelid, and root.
Referenced by generate_join_implied_equalities(), and make_join_rel().
void add_paths_to_append_rel | ( | PlannerInfo * | root, |
RelOptInfo * | rel, | ||
List * | live_childrels | ||
) |
Definition at line 1314 of file allpaths.c.
References accumulate_append_subpath(), add_partial_path(), add_path(), Assert, bms_equal(), RelOptInfo::cheapest_startup_path, RelOptInfo::cheapest_total_path, compare_pathkeys(), RelOptInfo::consider_parallel, RelOptInfo::consider_startup, create_append_path(), enable_parallel_append, for_each_from, generate_orderedappend_paths(), get_cheapest_parallel_safe_total_inner(), get_cheapest_parameterized_child_path(), lappend(), lfirst, linitial, list_length(), list_make1, Max, max_parallel_workers_per_gather, Min, NIL, Path::parallel_workers, RelOptInfo::partial_pathlist, AppendPath::path, PATH_REQ_OUTER, Path::pathkeys, PATHKEYS_EQUAL, RelOptInfo::pathlist, pg_leftmost_one_pos32(), root, Path::rows, subpath(), and Path::total_cost.
Referenced by apply_scanjoin_target_to_paths(), create_partitionwise_grouping_paths(), generate_partitionwise_join_paths(), and set_append_rel_pathlist().
void add_paths_to_joinrel | ( | PlannerInfo * | root, |
RelOptInfo * | joinrel, | ||
RelOptInfo * | outerrel, | ||
RelOptInfo * | innerrel, | ||
JoinType | jointype, | ||
SpecialJoinInfo * | sjinfo, | ||
List * | restrictlist | ||
) |
Definition at line 124 of file joinpath.c.
References bms_add_members(), bms_difference(), bms_is_subset(), bms_join(), bms_overlap(), compute_semi_anti_join_factors(), enable_hashjoin, enable_mergejoin, hash_inner_and_outer(), JoinPathExtraData::inner_unique, innerrel_is_unique(), JOIN_ANTI, JOIN_FULL, JOIN_INNER, JOIN_SEMI, JOIN_UNIQUE_INNER, JOIN_UNIQUE_OUTER, SpecialJoinInfo::jointype, RelOptInfo::lateral_relids, lfirst, match_unsorted_outer(), JoinPathExtraData::mergeclause_list, SpecialJoinInfo::min_lefthand, SpecialJoinInfo::min_righthand, NIL, JoinPathExtraData::param_source_rels, RelOptInfo::relids, RELOPT_OTHER_JOINREL, RelOptInfo::reloptkind, JoinPathExtraData::restrictlist, root, select_mergejoin_clauses(), JoinPathExtraData::semifactors, set_join_pathlist_hook, JoinPathExtraData::sjinfo, sort_inner_and_outer(), and RelOptInfo::top_parent_relids.
Referenced by populate_joinrel_with_paths().
void add_setop_child_rel_equivalences | ( | PlannerInfo * | root, |
RelOptInfo * | child_rel, | ||
List * | child_tlist, | ||
List * | setop_pathkeys | ||
) |
Definition at line 2942 of file equivclass.c.
References add_eq_member(), bms_add_range(), RelOptInfo::eclass_indexes, elog, EquivalenceMember::em_jdomain, ERROR, TargetEntry::expr, exprType(), lfirst_node, linitial, list_head(), list_length(), lnext(), RelOptInfo::relids, and root.
Referenced by build_setop_child_paths().
Definition at line 107 of file pathkeys.c.
References Assert, lappend(), lfirst_node, NIL, pathkey_is_redundant(), and source.
Referenced by adjust_group_pathkeys_for_groupagg(), and make_pathkeys_for_window().
List* build_expression_pathkey | ( | PlannerInfo * | root, |
Expr * | expr, | ||
Oid | opno, | ||
Relids | rel, | ||
bool | create_it | ||
) |
Definition at line 1000 of file pathkeys.c.
References BTGreaterStrategyNumber, elog, ERROR, exprCollation(), get_ordering_op_properties(), list_make1, make_pathkey_from_sortinfo(), NIL, and root.
Referenced by set_function_pathlist().
List* build_index_pathkeys | ( | PlannerInfo * | root, |
IndexOptInfo * | index, | ||
ScanDirection | scandir | ||
) |
Definition at line 740 of file pathkeys.c.
References TargetEntry::expr, i, indexcol_is_bool_constant_for_query(), lappend(), lfirst, make_pathkey_from_sortinfo(), NIL, pathkey_is_redundant(), root, and ScanDirectionIsBackward.
Referenced by build_index_paths().
List* build_join_pathkeys | ( | PlannerInfo * | root, |
RelOptInfo * | joinrel, | ||
JoinType | jointype, | ||
List * | outer_pathkeys | ||
) |
Definition at line 1294 of file pathkeys.c.
References Assert, JOIN_FULL, JOIN_RIGHT, JOIN_RIGHT_ANTI, JOIN_RIGHT_SEMI, NIL, root, and truncate_useless_pathkeys().
Referenced by consider_parallel_mergejoin(), consider_parallel_nestloop(), match_unsorted_outer(), and sort_inner_and_outer().
List* build_partition_pathkeys | ( | PlannerInfo * | root, |
RelOptInfo * | partrel, | ||
ScanDirection | scandir, | ||
bool * | partialkeys | ||
) |
Definition at line 919 of file pathkeys.c.
References Assert, i, IS_SIMPLE_REL, lappend(), linitial, RelOptInfo::live_parts, make_pathkey_from_sortinfo(), NIL, PartitionSchemeData::partcollation, partitions_are_ordered(), partkey_is_bool_constant_for_query(), PartitionSchemeData::partnatts, PartitionSchemeData::partopcintype, PartitionSchemeData::partopfamily, pathkey_is_redundant(), RelOptInfo::relids, root, and ScanDirectionIsBackward.
Referenced by generate_orderedappend_paths().
Definition at line 471 of file equivclass.c.
References applyRelabelType(), COERCE_IMPLICIT_CAST, exprCollation(), exprType(), and exprTypmod().
Referenced by convert_subquery_pathkeys(), get_eclass_for_sort_expr(), and process_equivalence().
void check_index_predicates | ( | PlannerInfo * | root, |
RelOptInfo * | rel | ||
) |
Definition at line 3946 of file indxpath.c.
References Assert, RelOptInfo::baserestrictinfo, bms_del_members(), bms_difference(), bms_is_empty, bms_is_member(), bms_union(), RestrictInfo::clause, contain_mutable_functions(), find_childrel_parents(), generate_join_implied_equalities(), get_plan_rowmark(), RelOptInfo::indexlist, IS_SIMPLE_REL, join_clause_is_movable_to(), RelOptInfo::joininfo, lappend(), lfirst, list_concat(), list_copy(), list_make1, NIL, RelOptInfo::nulling_relids, predicate_implied_by(), RelOptInfo::relid, RelOptInfo::relids, RELOPT_OTHER_MEMBER_REL, RelOptInfo::reloptkind, and root.
Referenced by set_plain_rel_size(), and set_tablesample_rel_size().
PathKeysComparison compare_pathkeys | ( | List * | keys1, |
List * | keys2 | ||
) |
Definition at line 304 of file pathkeys.c.
References forboth, lfirst, PATHKEYS_BETTER1, PATHKEYS_BETTER2, PATHKEYS_DIFFERENT, and PATHKEYS_EQUAL.
Referenced by add_partial_path(), add_partial_path_precheck(), add_path(), add_path_precheck(), add_paths_to_append_rel(), adjust_group_pathkeys_for_groupagg(), get_useful_group_keys_orderings(), pathkeys_contained_in(), and set_cheapest().
int compute_parallel_worker | ( | RelOptInfo * | rel, |
double | heap_pages, | ||
double | index_pages, | ||
int | max_workers | ||
) |
Definition at line 4214 of file allpaths.c.
References Max, Min, min_parallel_index_scan_size, min_parallel_table_scan_size, RelOptInfo::rel_parallel_workers, RELOPT_BASEREL, and RelOptInfo::reloptkind.
Referenced by cost_index(), create_partial_bitmap_paths(), create_plain_partial_paths(), and plan_create_index_workers().
List* convert_subquery_pathkeys | ( | PlannerInfo * | root, |
RelOptInfo * | rel, | ||
List * | subquery_pathkeys, | ||
List * | subquery_tlist | ||
) |
Definition at line 1054 of file pathkeys.c.
References Assert, canonicalize_ec_expression(), EquivalenceClass::ec_collation, EquivalenceClass::ec_has_volatile, EquivalenceClass::ec_members, EquivalenceClass::ec_opfamilies, EquivalenceClass::ec_sortref, elog, EquivalenceMember::em_datatype, EquivalenceMember::em_expr, EquivalenceMember::em_is_child, equal(), ERROR, TargetEntry::expr, find_var_for_subquery_tle(), get_eclass_for_sort_expr(), get_sortgroupref_tle(), i, j, lappend(), lfirst, linitial, list_length(), list_nth(), make_canonical_pathkey(), NIL, pathkey_is_redundant(), PathKey::pk_nulls_first, PathKey::pk_opfamily, PathKey::pk_strategy, RelOptInfo::relids, and root.
Referenced by build_setop_child_paths(), set_cte_pathlist(), and set_subquery_pathlist().
void create_index_paths | ( | PlannerInfo * | root, |
RelOptInfo * | rel | ||
) |
Definition at line 241 of file indxpath.c.
References add_path(), Assert, RelOptInfo::baserestrictinfo, bms_is_subset(), choose_bitmap_and(), consider_index_join_clauses(), RelOptInfo::consider_parallel, create_bitmap_heap_path(), create_partial_bitmap_paths(), generate_bitmap_or_paths(), get_index_paths(), get_loop_count(), INDEX_MAX_KEYS, RelOptInfo::indexlist, lappend(), RelOptInfo::lateral_relids, lfirst, list_append_unique(), list_concat(), match_eclass_clauses_to_index(), match_join_clauses_to_index(), match_restriction_clauses_to_index(), MemSet, NIL, IndexClauseSet::nonempty, PATH_REQ_OUTER, RelOptInfo::relid, and root.
Referenced by set_plain_rel_pathlist().
void create_partial_bitmap_paths | ( | PlannerInfo * | root, |
RelOptInfo * | rel, | ||
Path * | bitmapqual | ||
) |
Definition at line 4178 of file allpaths.c.
References add_partial_path(), compute_bitmap_pages(), compute_parallel_worker(), create_bitmap_heap_path(), RelOptInfo::lateral_relids, max_parallel_workers_per_gather, and root.
Referenced by create_index_paths().
bool create_tidscan_paths | ( | PlannerInfo * | root, |
RelOptInfo * | rel | ||
) |
Definition at line 498 of file tidpath.c.
References add_path(), RelOptInfo::baserestrictinfo, BuildParameterizedTidPaths(), create_tidrangescan_path(), create_tidscan_path(), ec_member_matches_ctid(), enable_tidscan, generate_implied_equalities_for_column(), RelOptInfo::has_eclass_joins, RelOptInfo::joininfo, RelOptInfo::lateral_referencers, RelOptInfo::lateral_relids, NIL, root, TidQualFromRestrictInfoList(), and TidRangeQualFromRestrictInfoList().
Referenced by set_plain_rel_pathlist().
bool eclass_useful_for_merging | ( | PlannerInfo * | root, |
EquivalenceClass * | eclass, | ||
RelOptInfo * | rel | ||
) |
Definition at line 3266 of file equivclass.c.
References Assert, bms_is_empty, bms_is_subset(), bms_overlap(), eclass(), EquivalenceMember::em_is_child, EquivalenceMember::em_relids, IS_OTHER_REL, lfirst, list_length(), RelOptInfo::relids, and RelOptInfo::top_parent_relids.
Referenced by get_useful_ecs_for_relation(), and pathkeys_useful_for_merging().
bool exprs_known_equal | ( | PlannerInfo * | root, |
Node * | item1, | ||
Node * | item2, | ||
Oid | opfamily | ||
) |
Definition at line 2498 of file equivclass.c.
References EquivalenceClass::ec_has_volatile, EquivalenceClass::ec_members, EquivalenceClass::ec_opfamilies, EquivalenceMember::em_expr, EquivalenceMember::em_is_child, equal(), lfirst, list_member_oid(), OidIsValid, and root.
Referenced by add_unique_group_var(), and have_partkey_equi_join().
EquivalenceMember* find_computable_ec_member | ( | PlannerInfo * | root, |
EquivalenceClass * | ec, | ||
List * | exprs, | ||
Relids | relids, | ||
bool | require_parallel_safe | ||
) |
Definition at line 837 of file equivclass.c.
References bms_is_subset(), EquivalenceClass::ec_members, EquivalenceMember::em_expr, EquivalenceMember::em_is_child, EquivalenceMember::em_is_const, EquivalenceMember::em_relids, is_parallel_safe(), lfirst, list_free(), list_member(), pull_var_clause(), PVC_INCLUDE_AGGREGATES, PVC_INCLUDE_PLACEHOLDERS, PVC_INCLUDE_WINDOWFUNCS, and root.
Referenced by prepare_sort_from_pathkeys(), and relation_can_be_sorted_early().
RestrictInfo* find_derived_clause_for_ec_member | ( | EquivalenceClass * | ec, |
EquivalenceMember * | em | ||
) |
Definition at line 2650 of file equivclass.c.
References Assert, EquivalenceClass::ec_derives, EquivalenceClass::ec_has_const, EquivalenceMember::em_is_const, and lfirst.
Referenced by get_foreign_key_join_selectivity().
EquivalenceMember* find_ec_member_matching_expr | ( | EquivalenceClass * | ec, |
Expr * | expr, | ||
Relids | relids | ||
) |
Definition at line 763 of file equivclass.c.
References arg, bms_is_subset(), EquivalenceClass::ec_members, EquivalenceMember::em_expr, EquivalenceMember::em_is_child, EquivalenceMember::em_is_const, EquivalenceMember::em_relids, equal(), IsA, and lfirst.
Referenced by make_unique_from_pathkeys(), prepare_sort_from_pathkeys(), and relation_can_be_sorted_early().
List* find_mergeclauses_for_outer_pathkeys | ( | PlannerInfo * | root, |
List * | pathkeys, | ||
List * | restrictinfos | ||
) |
Definition at line 1543 of file pathkeys.c.
References i, j, lappend(), lfirst, list_concat(), NIL, root, and update_mergeclause_eclasses().
Referenced by generate_mergejoin_paths(), and sort_inner_and_outer().
void generate_base_implied_equalities | ( | PlannerInfo * | root | ) |
Definition at line 1032 of file equivclass.c.
References Assert, bms_add_member(), bms_is_member(), bms_membership(), BMS_MULTIPLE, bms_next_member(), EquivalenceClass::ec_broken, EquivalenceClass::ec_has_const, EquivalenceClass::ec_members, EquivalenceClass::ec_merged, EquivalenceClass::ec_relids, RelOptInfo::eclass_indexes, generate_base_implied_equalities_broken(), generate_base_implied_equalities_const(), generate_base_implied_equalities_no_const(), RelOptInfo::has_eclass_joins, i, lfirst, list_length(), RELOPT_BASEREL, RelOptInfo::reloptkind, and root.
Referenced by query_planner().
void generate_gather_paths | ( | PlannerInfo * | root, |
RelOptInfo * | rel, | ||
bool | override_rows | ||
) |
Definition at line 3064 of file allpaths.c.
References add_path(), compute_gather_rows(), create_gather_merge_path(), create_gather_path(), lfirst, linitial, NIL, RelOptInfo::partial_pathlist, GatherMergePath::path, RelOptInfo::reltarget, root, and subpath().
Referenced by generate_useful_gather_paths().
List* generate_implied_equalities_for_column | ( | PlannerInfo * | root, |
RelOptInfo * | rel, | ||
ec_matches_callback_type | callback, | ||
void * | callback_arg, | ||
Relids | prohibited_rels | ||
) |
Definition at line 3014 of file equivclass.c.
References Assert, bms_equal(), bms_is_subset(), bms_next_member(), bms_overlap(), callback(), create_join_clause(), EquivalenceClass::ec_has_const, EquivalenceClass::ec_members, EquivalenceClass::ec_relids, RelOptInfo::eclass_indexes, EquivalenceMember::em_datatype, EquivalenceMember::em_is_child, EquivalenceMember::em_relids, find_childrel_parents(), i, IS_SIMPLE_REL, lappend(), lfirst, list_length(), list_nth(), NIL, OidIsValid, RelOptInfo::relids, RELOPT_OTHER_MEMBER_REL, RelOptInfo::reloptkind, root, and select_equality_operator().
Referenced by create_tidscan_paths(), match_eclass_clauses_to_index(), and postgresGetForeignPaths().
List* generate_join_implied_equalities | ( | PlannerInfo * | root, |
Relids | join_relids, | ||
Relids | outer_relids, | ||
RelOptInfo * | inner_rel, | ||
SpecialJoinInfo * | sjinfo | ||
) |
Definition at line 1385 of file equivclass.c.
References add_outer_joins_to_relids(), Assert, bms_is_empty, bms_next_member(), bms_overlap(), bms_union(), EquivalenceClass::ec_broken, EquivalenceClass::ec_has_const, EquivalenceClass::ec_members, EquivalenceClass::ec_relids, generate_join_implied_equalities_broken(), generate_join_implied_equalities_normal(), get_common_eclass_indexes(), get_eclass_indexes_for_relids(), i, IS_OTHER_REL, list_concat(), list_length(), list_nth(), NIL, SpecialJoinInfo::ojrelid, RelOptInfo::relids, root, and RelOptInfo::top_parent_relids.
Referenced by build_joinrel_restrictlist(), check_index_predicates(), get_baserel_parampathinfo(), get_joinrel_parampathinfo(), and reduce_unique_semijoins().
List* generate_join_implied_equalities_for_ecs | ( | PlannerInfo * | root, |
List * | eclasses, | ||
Relids | join_relids, | ||
Relids | outer_relids, | ||
RelOptInfo * | inner_rel | ||
) |
Definition at line 1485 of file equivclass.c.
References Assert, bms_is_empty, bms_overlap(), bms_union(), EquivalenceClass::ec_broken, EquivalenceClass::ec_has_const, EquivalenceClass::ec_members, EquivalenceClass::ec_relids, generate_join_implied_equalities_broken(), generate_join_implied_equalities_normal(), IS_OTHER_REL, lfirst, list_concat(), list_length(), NIL, RelOptInfo::relids, root, and RelOptInfo::top_parent_relids.
Referenced by get_joinrel_parampathinfo().
void generate_partitionwise_join_paths | ( | PlannerInfo * | root, |
RelOptInfo * | rel | ||
) |
Definition at line 4302 of file allpaths.c.
References add_paths_to_append_rel(), Assert, check_stack_depth(), RelOptInfo::consider_partitionwise_join, IS_DUMMY_REL, IS_JOIN_REL, IS_PARTITIONED_REL, lappend(), list_free(), mark_dummy_rel(), NIL, RelOptInfo::nparts, RelOptInfo::pathlist, pprint(), root, and set_cheapest().
Referenced by merge_clump(), and standard_join_search().
void generate_useful_gather_paths | ( | PlannerInfo * | root, |
RelOptInfo * | rel, | ||
bool | override_rows | ||
) |
Definition at line 3201 of file allpaths.c.
References add_path(), compute_gather_rows(), create_gather_merge_path(), create_incremental_sort_path(), create_sort_path(), enable_incremental_sort, generate_gather_paths(), get_useful_pathkeys_for_relation(), lfirst, linitial, NIL, RelOptInfo::partial_pathlist, GatherMergePath::path, pathkeys_count_contained_in(), RelOptInfo::reltarget, root, and subpath().
Referenced by apply_scanjoin_target_to_paths(), create_partial_distinct_paths(), gather_grouping_paths(), merge_clump(), set_rel_pathlist(), and standard_join_search().
Path* get_cheapest_fractional_path_for_pathkeys | ( | List * | paths, |
List * | pathkeys, | ||
Relids | required_outer, | ||
double | fraction | ||
) |
Definition at line 666 of file pathkeys.c.
References bms_is_subset(), compare_fractional_path_costs(), lfirst, PATH_REQ_OUTER, Path::pathkeys, and pathkeys_contained_in().
Referenced by build_minmax_path(), and generate_orderedappend_paths().
Definition at line 699 of file pathkeys.c.
References bms_is_empty, lfirst, Path::parallel_safe, and PATH_REQ_OUTER.
Referenced by add_paths_to_append_rel(), hash_inner_and_outer(), match_unsorted_outer(), and sort_inner_and_outer().
Path* get_cheapest_path_for_pathkeys | ( | List * | paths, |
List * | pathkeys, | ||
Relids | required_outer, | ||
CostSelector | cost_criterion, | ||
bool | require_parallel_safe | ||
) |
Definition at line 620 of file pathkeys.c.
References bms_is_subset(), compare_path_costs(), lfirst, Path::parallel_safe, PATH_REQ_OUTER, Path::pathkeys, and pathkeys_contained_in().
Referenced by generate_mergejoin_paths(), generate_orderedappend_paths(), generate_union_paths(), and get_cheapest_parameterized_child_path().
EquivalenceClass* get_eclass_for_sort_expr | ( | PlannerInfo * | root, |
Expr * | expr, | ||
List * | opfamilies, | ||
Oid | opcintype, | ||
Oid | collation, | ||
Index | sortref, | ||
Relids | rel, | ||
bool | create_it | ||
) |
Definition at line 586 of file equivclass.c.
References add_eq_member(), Assert, bms_add_member(), bms_equal(), bms_is_member(), bms_next_member(), canonicalize_ec_expression(), contain_agg_clause(), contain_volatile_functions(), contain_window_function(), copyObject, EquivalenceClass::ec_broken, EquivalenceClass::ec_collation, EquivalenceClass::ec_derives, EquivalenceClass::ec_has_const, EquivalenceClass::ec_has_volatile, EquivalenceClass::ec_max_security, EquivalenceClass::ec_members, EquivalenceClass::ec_merged, EquivalenceClass::ec_min_security, EquivalenceClass::ec_opfamilies, EquivalenceClass::ec_relids, EquivalenceClass::ec_sortref, EquivalenceClass::ec_sources, RelOptInfo::eclass_indexes, elog, EquivalenceMember::em_datatype, EquivalenceMember::em_expr, EquivalenceMember::em_is_child, EquivalenceMember::em_is_const, EquivalenceMember::em_jdomain, EquivalenceMember::em_relids, equal(), ERROR, expression_returns_set(), i, lappend(), lfirst, linitial_node, list_copy(), list_length(), makeNode, MemoryContextSwitchTo(), NIL, pull_varnos(), RELOPT_BASEREL, RelOptInfo::reloptkind, and root.
Referenced by convert_subquery_pathkeys(), initialize_mergeclause_eclasses(), and make_pathkey_from_sortinfo().
List* get_useful_group_keys_orderings | ( | PlannerInfo * | root, |
Path * | path | ||
) |
Definition at line 467 of file pathkeys.c.
References Assert, GroupByOrdering::clauses, compare_pathkeys(), enable_group_by_reordering, enable_incremental_sort, for_each_from, forboth, group_keys_reorder_by_pathkeys(), lappend(), lfirst_node, linitial_node, list_difference(), list_difference_ptr(), list_length(), makeNode, NIL, parse(), GroupByOrdering::pathkeys, Path::pathkeys, pathkeys_contained_in(), PATHKEYS_EQUAL, root, and SortGroupClause::tleSortGroupRef.
Referenced by add_paths_to_grouping_rel(), and create_partial_grouping_paths().
bool has_relevant_eclass_joinclause | ( | PlannerInfo * | root, |
RelOptInfo * | rel1 | ||
) |
Definition at line 3222 of file equivclass.c.
References bms_is_subset(), bms_next_member(), EquivalenceClass::ec_members, EquivalenceClass::ec_relids, get_eclass_indexes_for_relids(), i, list_length(), list_nth(), RelOptInfo::relids, and root.
Referenced by build_join_rel().
bool has_useful_pathkeys | ( | PlannerInfo * | root, |
RelOptInfo * | rel | ||
) |
Definition at line 2277 of file pathkeys.c.
References RelOptInfo::has_eclass_joins, RelOptInfo::joininfo, NIL, and root.
Referenced by build_child_join_rel(), build_index_paths(), and set_append_rel_size().
bool have_dangerous_phv | ( | PlannerInfo * | root, |
Relids | outer_relids, | ||
Relids | inner_params | ||
) |
Definition at line 1307 of file joinrels.c.
References bms_is_subset(), bms_overlap(), lfirst, PlaceHolderInfo::ph_eval_at, and root.
Referenced by join_is_legal(), and try_nestloop_path().
bool have_join_order_restriction | ( | PlannerInfo * | root, |
RelOptInfo * | rel1, | ||
RelOptInfo * | rel2 | ||
) |
Definition at line 1074 of file joinrels.c.
References bms_is_subset(), bms_overlap(), RelOptInfo::direct_lateral_relids, has_legal_joinclause(), JOIN_FULL, SpecialJoinInfo::jointype, lfirst, SpecialJoinInfo::min_lefthand, SpecialJoinInfo::min_righthand, PlaceHolderInfo::ph_eval_at, RelOptInfo::relids, and root.
Referenced by desirable_join(), join_search_one_level(), and make_rels_by_clause_joins().
bool have_relevant_eclass_joinclause | ( | PlannerInfo * | root, |
RelOptInfo * | rel1, | ||
RelOptInfo * | rel2 | ||
) |
Definition at line 3146 of file equivclass.c.
References Assert, bms_next_member(), bms_overlap(), EquivalenceClass::ec_members, EquivalenceClass::ec_relids, get_common_eclass_indexes(), i, list_length(), list_nth(), RelOptInfo::relids, and root.
Referenced by have_relevant_joinclause().
bool indexcol_is_bool_constant_for_query | ( | PlannerInfo * | root, |
IndexOptInfo * | index, | ||
int | indexcol | ||
) |
Definition at line 4316 of file indxpath.c.
References IsBooleanOpfamily(), lfirst, match_boolean_index_clause(), and root.
Referenced by build_index_pathkeys().
void init_dummy_sjinfo | ( | SpecialJoinInfo * | sjinfo, |
Relids | left_relids, | ||
Relids | right_relids | ||
) |
Definition at line 669 of file joinrels.c.
References SpecialJoinInfo::commute_above_l, SpecialJoinInfo::commute_above_r, SpecialJoinInfo::commute_below_l, SpecialJoinInfo::commute_below_r, JOIN_INNER, SpecialJoinInfo::jointype, SpecialJoinInfo::lhs_strict, SpecialJoinInfo::min_lefthand, SpecialJoinInfo::min_righthand, NIL, SpecialJoinInfo::ojrelid, SpecialJoinInfo::semi_can_btree, SpecialJoinInfo::semi_can_hash, SpecialJoinInfo::semi_operators, SpecialJoinInfo::semi_rhs_exprs, SpecialJoinInfo::syn_lefthand, and SpecialJoinInfo::syn_righthand.
Referenced by approx_tuple_count(), build_child_join_sjinfo(), compute_semi_anti_join_factors(), consider_new_or_clause(), and make_join_rel().
void initialize_mergeclause_eclasses | ( | PlannerInfo * | root, |
RestrictInfo * | restrictinfo | ||
) |
Definition at line 1462 of file pathkeys.c.
References Assert, RestrictInfo::clause, get_eclass_for_sort_expr(), get_leftop(), get_rightop(), NIL, op_input_types(), and root.
Referenced by distribute_qual_to_rels().
bool is_redundant_derived_clause | ( | RestrictInfo * | rinfo, |
List * | clauselist | ||
) |
Definition at line 3324 of file equivclass.c.
References lfirst.
Referenced by create_tidscan_plan().
bool is_redundant_with_indexclauses | ( | RestrictInfo * | rinfo, |
List * | indexclauses | ||
) |
Definition at line 3351 of file equivclass.c.
References lfirst_node, IndexClause::lossy, and IndexClause::rinfo.
Referenced by create_indexscan_plan(), extract_nonindex_conditions(), and has_indexed_join_quals().
void join_search_one_level | ( | PlannerInfo * | root, |
int | level | ||
) |
Definition at line 72 of file joinrels.c.
References Assert, bms_overlap(), elog, ERROR, for_each_from, foreach_current_index, RelOptInfo::has_eclass_joins, has_join_restriction(), have_join_order_restriction(), have_relevant_joinclause(), RelOptInfo::joininfo, lfirst, make_join_rel(), make_rels_by_clause_joins(), make_rels_by_clauseless_joins(), NIL, RelOptInfo::relids, and root.
Referenced by standard_join_search().
PathKey* make_canonical_pathkey | ( | PlannerInfo * | root, |
EquivalenceClass * | eclass, | ||
Oid | opfamily, | ||
int | strategy, | ||
bool | nulls_first | ||
) |
Definition at line 56 of file pathkeys.c.
References eclass(), elog, ERROR, lappend(), lfirst, makeNode, MemoryContextSwitchTo(), PathKey::pk_nulls_first, PathKey::pk_opfamily, PathKey::pk_strategy, and root.
Referenced by convert_subquery_pathkeys(), get_useful_pathkeys_for_relation(), make_inner_pathkeys_for_merge(), make_pathkey_from_sortinfo(), and select_outer_pathkeys_for_merge().
List* make_inner_pathkeys_for_merge | ( | PlannerInfo * | root, |
List * | mergeclauses, | ||
List * | outer_pathkeys | ||
) |
Definition at line 1854 of file pathkeys.c.
References elog, ERROR, lappend(), lfirst, list_head(), lnext(), make_canonical_pathkey(), NIL, pathkey_is_redundant(), PathKey::pk_nulls_first, PathKey::pk_opfamily, PathKey::pk_strategy, root, and update_mergeclause_eclasses().
Referenced by generate_mergejoin_paths(), and sort_inner_and_outer().
RelOptInfo* make_join_rel | ( | PlannerInfo * | root, |
RelOptInfo * | rel1, | ||
RelOptInfo * | rel2 | ||
) |
Definition at line 704 of file joinrels.c.
References add_outer_joins_to_relids(), Assert, bms_free(), bms_overlap(), bms_union(), build_join_rel(), init_dummy_sjinfo(), is_dummy_rel(), join_is_legal(), NIL, populate_joinrel_with_paths(), RelOptInfo::relids, and root.
Referenced by join_search_one_level(), make_rels_by_clause_joins(), make_rels_by_clauseless_joins(), and merge_clump().
RelOptInfo* make_one_rel | ( | PlannerInfo * | root, |
List * | joinlist | ||
) |
Definition at line 171 of file allpaths.c.
References Assert, bms_equal(), IS_DUMMY_REL, IS_SIMPLE_REL, make_rel_from_joinlist(), RelOptInfo::pages, RelOptInfo::relid, RelOptInfo::relids, root, set_base_rel_consider_startup(), set_base_rel_pathlists(), and set_base_rel_sizes().
Referenced by query_planner().
List* make_pathkeys_for_sortclauses | ( | PlannerInfo * | root, |
List * | sortclauses, | ||
List * | tlist | ||
) |
Definition at line 1335 of file pathkeys.c.
References Assert, make_pathkeys_for_sortclauses_extended(), and root.
Referenced by adjust_group_pathkeys_for_groupagg(), generate_nonunion_paths(), generate_union_paths(), grouping_planner(), make_pathkeys_for_window(), minmax_qp_callback(), and standard_qp_callback().
List* make_pathkeys_for_sortclauses_extended | ( | PlannerInfo * | root, |
List ** | sortclauses, | ||
List * | tlist, | ||
bool | remove_redundant, | ||
bool | remove_group_rtindex, | ||
bool * | sortable, | ||
bool | set_ec_sortref | ||
) |
Definition at line 1380 of file pathkeys.c.
References Assert, bms_make_singleton(), foreach_delete_current, get_sortgroupclause_expr(), lappend(), lfirst, make_pathkey_from_sortop(), NIL, SortGroupClause::nulls_first, OidIsValid, pathkey_is_redundant(), remove_nulling_relids(), SortGroupClause::reverse_sort, root, SortGroupClause::sortop, and SortGroupClause::tleSortGroupRef.
Referenced by make_pathkeys_for_sortclauses(), make_pathkeys_for_window(), and standard_qp_callback().
void mark_dummy_rel | ( | RelOptInfo * | rel | ) |
Definition at line 1384 of file joinrels.c.
References add_path(), create_append_path(), GetMemoryChunkContext(), is_dummy_rel(), RelOptInfo::lateral_relids, MemoryContextSwitchTo(), NIL, RelOptInfo::partial_pathlist, RelOptInfo::pathlist, RelOptInfo::rows, and set_cheapest().
Referenced by build_simple_rel(), generate_partitionwise_join_paths(), and populate_joinrel_with_paths().
EquivalenceClass* match_eclasses_to_foreign_key_col | ( | PlannerInfo * | root, |
ForeignKeyOptInfo * | fkinfo, | ||
int | colno | ||
) |
Definition at line 2559 of file equivclass.c.
References Assert, bms_intersect(), bms_next_member(), ForeignKeyOptInfo::con_relid, EquivalenceClass::ec_has_volatile, EquivalenceClass::ec_members, EquivalenceClass::ec_opfamilies, ForeignKeyOptInfo::eclass, RelOptInfo::eclass_indexes, EquivalenceMember::em_expr, EquivalenceMember::em_is_child, equal(), ForeignKeyOptInfo::fk_eclass_member, get_mergejoin_opfamilies(), i, IS_SIMPLE_REL, IsA, lfirst, list_nth(), NIL, ForeignKeyOptInfo::ref_relid, root, Var::varattno, Var::varno, and while().
Referenced by match_foreign_keys_to_quals().
bool match_index_to_operand | ( | Node * | operand, |
int | indexcol, | ||
IndexOptInfo * | index | ||
) |
Definition at line 4367 of file indxpath.c.
References arg, elog, equal(), ERROR, i, IsA, lfirst, list_head(), and lnext().
Referenced by ec_member_matches_indexcol(), expand_indexqual_rowcompare(), get_actual_variable_range(), group_similar_or_args(), match_boolean_index_clause(), match_clause_to_indexcol(), match_clause_to_ordering_op(), match_funcclause_to_indexcol(), match_opclause_to_indexcol(), match_orclause_to_indexcol(), match_rowcompare_to_indexcol(), match_saopclause_to_indexcol(), and relation_has_unique_index_for().
Definition at line 343 of file pathkeys.c.
References compare_pathkeys(), PATHKEYS_BETTER2, and PATHKEYS_EQUAL.
Referenced by add_paths_with_pathkeys_for_rel(), adjust_foreign_grouping_path_cost(), consider_groupingsets_paths(), cost_append(), create_append_plan(), create_gather_merge_path(), create_gather_merge_plan(), create_merge_append_path(), create_merge_append_plan(), generate_mergejoin_paths(), generate_orderedappend_paths(), get_cheapest_fractional_path_for_pathkeys(), get_cheapest_path_for_pathkeys(), get_useful_group_keys_orderings(), try_mergejoin_path(), and try_partial_mergejoin_path().
Definition at line 558 of file pathkeys.c.
References forboth, lfirst, list_length(), and NIL.
Referenced by build_setop_child_paths(), create_final_distinct_paths(), create_mergejoin_plan(), create_one_window_path(), create_ordered_paths(), create_partial_distinct_paths(), create_window_paths(), gather_grouping_paths(), generate_useful_gather_paths(), initial_cost_mergejoin(), make_ordered_path(), pathkeys_useful_for_ordering(), and pathkeys_useful_for_setop().
bool process_equivalence | ( | PlannerInfo * | root, |
RestrictInfo ** | p_restrictinfo, | ||
JoinDomain * | jdomain | ||
) |
Definition at line 117 of file equivclass.c.
References add_eq_member(), NullTest::arg, Assert, bms_join(), canonicalize_ec_expression(), RestrictInfo::clause, EquivalenceClass::ec_broken, EquivalenceClass::ec_collation, EquivalenceClass::ec_derives, EquivalenceClass::ec_has_const, EquivalenceClass::ec_has_volatile, EquivalenceClass::ec_max_security, EquivalenceClass::ec_members, EquivalenceClass::ec_merged, EquivalenceClass::ec_min_security, EquivalenceClass::ec_opfamilies, EquivalenceClass::ec_relids, EquivalenceClass::ec_sortref, EquivalenceClass::ec_sources, elog, EquivalenceMember::em_datatype, EquivalenceMember::em_expr, EquivalenceMember::em_is_child, EquivalenceMember::em_is_const, EquivalenceMember::em_jdomain, equal(), ERROR, exprType(), foreach_current_index, func_strict(), get_leftop(), get_rightop(), RestrictInfo::has_clone, RestrictInfo::incompatible_relids, RestrictInfo::is_clone, IS_NOT_NULL, is_opclause(), RestrictInfo::is_pushed_down, lappend(), lfirst, list_concat(), list_delete_nth_cell(), list_make1, NullTest::location, make_restrictinfo(), makeNode, Max, Min, NIL, NullTest::nulltesttype, op_input_types(), RestrictInfo::outer_relids, root, RestrictInfo::security_level, and set_opfuncid().
Referenced by distribute_qual_to_rels(), reconsider_full_join_clause(), and reconsider_outer_join_clause().
void rebuild_eclass_attr_needed | ( | PlannerInfo * | root | ) |
Definition at line 2431 of file equivclass.c.
References add_vars_to_attr_needed(), EquivalenceClass::ec_has_const, EquivalenceClass::ec_members, EquivalenceClass::ec_relids, EquivalenceMember::em_expr, lfirst, list_free(), list_length(), pull_var_clause(), PVC_INCLUDE_PLACEHOLDERS, PVC_RECURSE_AGGREGATES, PVC_RECURSE_WINDOWFUNCS, and root.
Referenced by remove_rel_from_query().
void reconsider_outer_join_clauses | ( | PlannerInfo * | root | ) |
Definition at line 2001 of file equivclass.c.
References distribute_restrictinfo_to_rels(), foreach_delete_current, RestrictInfo::has_clone, RestrictInfo::incompatible_relids, RestrictInfo::is_clone, RestrictInfo::is_pushed_down, lfirst, make_restrictinfo(), makeBoolConst(), RestrictInfo::outer_relids, reconsider_full_join_clause(), reconsider_outer_join_clause(), RestrictInfo::required_relids, OuterJoinClauseInfo::rinfo, and root.
Referenced by query_planner().
bool relation_can_be_sorted_early | ( | PlannerInfo * | root, |
RelOptInfo * | rel, | ||
EquivalenceClass * | ec, | ||
bool | require_parallel_safe | ||
) |
Definition at line 921 of file equivclass.c.
References EquivalenceClass::ec_has_volatile, EquivalenceMember::em_expr, expression_returns_set(), PathTarget::exprs, find_computable_ec_member(), find_ec_member_matching_expr(), is_parallel_safe(), lfirst, RelOptInfo::relids, RelOptInfo::reltarget, and root.
Referenced by get_useful_pathkeys_for_relation().
bool relation_has_unique_index_for | ( | PlannerInfo * | root, |
RelOptInfo * | rel, | ||
List * | restrictlist, | ||
List * | exprlist, | ||
List * | oprlist | ||
) |
Definition at line 4142 of file indxpath.c.
References Assert, RelOptInfo::baserestrictinfo, bms_is_empty, RestrictInfo::clause, forboth, get_leftop(), get_rightop(), RelOptInfo::indexlist, lappend(), lfirst, lfirst_oid, list_length(), list_member_oid(), match_index_to_operand(), NIL, and op_in_opfamily().
Referenced by create_unique_path(), and rel_is_distinct_for().
List* select_outer_pathkeys_for_merge | ( | PlannerInfo * | root, |
List * | mergeclauses, | ||
RelOptInfo * | joinrel | ||
) |
Definition at line 1658 of file pathkeys.c.
References Assert, bms_overlap(), BTLessStrategyNumber, EquivalenceClass::ec_members, EquivalenceClass::ec_opfamilies, EquivalenceMember::em_is_child, EquivalenceMember::em_is_const, EquivalenceMember::em_relids, j, lappend(), lfirst, linitial_oid, list_copy(), list_copy_head(), list_length(), make_canonical_pathkey(), NIL, palloc(), pathkey_is_redundant(), pfree(), RelOptInfo::relids, root, and update_mergeclause_eclasses().
Referenced by sort_inner_and_outer().
RelOptInfo* standard_join_search | ( | PlannerInfo * | root, |
int | levels_needed, | ||
List * | initial_rels | ||
) |
Definition at line 3422 of file allpaths.c.
References Assert, bms_equal(), elog, ERROR, generate_partitionwise_join_paths(), generate_useful_gather_paths(), join_search_one_level(), lfirst, linitial, list_length(), NIL, palloc0(), pprint(), RelOptInfo::relids, root, and set_cheapest().
Referenced by make_rel_from_joinlist().
List* trim_mergeclauses_for_inner_pathkeys | ( | PlannerInfo * | root, |
List * | mergeclauses, | ||
List * | pathkeys | ||
) |
Definition at line 1957 of file pathkeys.c.
References i, lappend(), lfirst, list_head(), lnext(), and NIL.
Referenced by generate_mergejoin_paths().
List* truncate_useless_pathkeys | ( | PlannerInfo * | root, |
RelOptInfo * | rel, | ||
List * | pathkeys | ||
) |
Definition at line 2231 of file pathkeys.c.
References list_copy_head(), list_length(), NIL, pathkeys_useful_for_grouping(), pathkeys_useful_for_merging(), pathkeys_useful_for_ordering(), pathkeys_useful_for_setop(), and root.
Referenced by build_index_paths(), and build_join_pathkeys().
void update_mergeclause_eclasses | ( | PlannerInfo * | root, |
RestrictInfo * | restrictinfo | ||
) |
Definition at line 1509 of file pathkeys.c.
Referenced by find_mergeclauses_for_outer_pathkeys(), get_useful_ecs_for_relation(), make_inner_pathkeys_for_merge(), pathkeys_useful_for_merging(), select_mergejoin_clauses(), and select_outer_pathkeys_for_merge().
|
extern |
Definition at line 79 of file allpaths.c.
Referenced by make_rel_from_joinlist().
|
extern |
Definition at line 32 of file pathkeys.c.
Referenced by get_useful_group_keys_orderings().
|
extern |
Definition at line 80 of file allpaths.c.
Referenced by make_rel_from_joinlist().
|
extern |
Definition at line 88 of file allpaths.c.
Referenced by make_rel_from_joinlist().
|
extern |
Definition at line 82 of file allpaths.c.
Referenced by compute_parallel_worker(), and parallel_vacuum_compute_workers().
|
extern |
Definition at line 81 of file allpaths.c.
Referenced by compute_parallel_worker().
|
extern |
Definition at line 33 of file joinpath.c.
Referenced by add_paths_to_joinrel().
|
extern |
Definition at line 85 of file allpaths.c.
Referenced by set_rel_pathlist().