PostgreSQL Source Code
git master
|
Go to the source code of this file.
Macros | |
#define | DEFAULT_SEQ_PAGE_COST 1.0 |
#define | DEFAULT_RANDOM_PAGE_COST 4.0 |
#define | DEFAULT_CPU_TUPLE_COST 0.01 |
#define | DEFAULT_CPU_INDEX_TUPLE_COST 0.005 |
#define | DEFAULT_CPU_OPERATOR_COST 0.0025 |
#define | DEFAULT_PARALLEL_TUPLE_COST 0.1 |
#define | DEFAULT_PARALLEL_SETUP_COST 1000.0 |
#define | DEFAULT_RECURSIVE_WORKTABLE_FACTOR 10.0 |
#define | DEFAULT_EFFECTIVE_CACHE_SIZE 524288 /* measured in pages */ |
Enumerations | |
enum | ConstraintExclusionType { CONSTRAINT_EXCLUSION_OFF , CONSTRAINT_EXCLUSION_ON , CONSTRAINT_EXCLUSION_PARTITION } |
Functions | |
double | index_pages_fetched (double tuples_fetched, BlockNumber pages, double index_pages, PlannerInfo *root) |
void | cost_seqscan (Path *path, PlannerInfo *root, RelOptInfo *baserel, ParamPathInfo *param_info) |
void | cost_samplescan (Path *path, PlannerInfo *root, RelOptInfo *baserel, ParamPathInfo *param_info) |
void | cost_index (IndexPath *path, PlannerInfo *root, double loop_count, bool partial_path) |
void | cost_bitmap_heap_scan (Path *path, PlannerInfo *root, RelOptInfo *baserel, ParamPathInfo *param_info, Path *bitmapqual, double loop_count) |
void | cost_bitmap_and_node (BitmapAndPath *path, PlannerInfo *root) |
void | cost_bitmap_or_node (BitmapOrPath *path, PlannerInfo *root) |
void | cost_bitmap_tree_node (Path *path, Cost *cost, Selectivity *selec) |
void | cost_tidscan (Path *path, PlannerInfo *root, RelOptInfo *baserel, List *tidquals, ParamPathInfo *param_info) |
void | cost_tidrangescan (Path *path, PlannerInfo *root, RelOptInfo *baserel, List *tidrangequals, ParamPathInfo *param_info) |
void | cost_subqueryscan (SubqueryScanPath *path, PlannerInfo *root, RelOptInfo *baserel, ParamPathInfo *param_info, bool trivial_pathtarget) |
void | cost_functionscan (Path *path, PlannerInfo *root, RelOptInfo *baserel, ParamPathInfo *param_info) |
void | cost_valuesscan (Path *path, PlannerInfo *root, RelOptInfo *baserel, ParamPathInfo *param_info) |
void | cost_tablefuncscan (Path *path, PlannerInfo *root, RelOptInfo *baserel, ParamPathInfo *param_info) |
void | cost_ctescan (Path *path, PlannerInfo *root, RelOptInfo *baserel, ParamPathInfo *param_info) |
void | cost_namedtuplestorescan (Path *path, PlannerInfo *root, RelOptInfo *baserel, ParamPathInfo *param_info) |
void | cost_resultscan (Path *path, PlannerInfo *root, RelOptInfo *baserel, ParamPathInfo *param_info) |
void | cost_recursive_union (Path *runion, Path *nrterm, Path *rterm) |
void | cost_sort (Path *path, PlannerInfo *root, List *pathkeys, int disabled_nodes, Cost input_cost, double tuples, int width, Cost comparison_cost, int sort_mem, double limit_tuples) |
void | cost_incremental_sort (Path *path, PlannerInfo *root, List *pathkeys, int presorted_keys, int input_disabled_nodes, Cost input_startup_cost, Cost input_total_cost, double input_tuples, int width, Cost comparison_cost, int sort_mem, double limit_tuples) |
void | cost_append (AppendPath *apath) |
void | cost_merge_append (Path *path, PlannerInfo *root, List *pathkeys, int n_streams, int input_disabled_nodes, Cost input_startup_cost, Cost input_total_cost, double tuples) |
void | cost_material (Path *path, int input_disabled_nodes, Cost input_startup_cost, Cost input_total_cost, double tuples, int width) |
void | cost_agg (Path *path, PlannerInfo *root, AggStrategy aggstrategy, const AggClauseCosts *aggcosts, int numGroupCols, double numGroups, List *quals, int input_disabled_nodes, Cost input_startup_cost, Cost input_total_cost, double input_tuples, double input_width) |
void | cost_windowagg (Path *path, PlannerInfo *root, List *windowFuncs, WindowClause *winclause, int input_disabled_nodes, Cost input_startup_cost, Cost input_total_cost, double input_tuples) |
void | cost_group (Path *path, PlannerInfo *root, int numGroupCols, double numGroups, List *quals, int input_disabled_nodes, Cost input_startup_cost, Cost input_total_cost, double input_tuples) |
void | initial_cost_nestloop (PlannerInfo *root, JoinCostWorkspace *workspace, JoinType jointype, Path *outer_path, Path *inner_path, JoinPathExtraData *extra) |
void | final_cost_nestloop (PlannerInfo *root, NestPath *path, JoinCostWorkspace *workspace, JoinPathExtraData *extra) |
void | initial_cost_mergejoin (PlannerInfo *root, JoinCostWorkspace *workspace, JoinType jointype, List *mergeclauses, Path *outer_path, Path *inner_path, List *outersortkeys, List *innersortkeys, JoinPathExtraData *extra) |
void | final_cost_mergejoin (PlannerInfo *root, MergePath *path, JoinCostWorkspace *workspace, 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 | final_cost_hashjoin (PlannerInfo *root, HashPath *path, JoinCostWorkspace *workspace, JoinPathExtraData *extra) |
void | cost_gather (GatherPath *path, PlannerInfo *root, RelOptInfo *rel, ParamPathInfo *param_info, double *rows) |
void | cost_gather_merge (GatherMergePath *path, PlannerInfo *root, RelOptInfo *rel, ParamPathInfo *param_info, int input_disabled_nodes, Cost input_startup_cost, Cost input_total_cost, double *rows) |
void | cost_subplan (PlannerInfo *root, SubPlan *subplan, Plan *plan) |
void | cost_qual_eval (QualCost *cost, List *quals, PlannerInfo *root) |
void | cost_qual_eval_node (QualCost *cost, Node *qual, PlannerInfo *root) |
void | compute_semi_anti_join_factors (PlannerInfo *root, RelOptInfo *joinrel, RelOptInfo *outerrel, RelOptInfo *innerrel, JoinType jointype, SpecialJoinInfo *sjinfo, List *restrictlist, SemiAntiJoinFactors *semifactors) |
void | set_baserel_size_estimates (PlannerInfo *root, RelOptInfo *rel) |
double | get_parameterized_baserel_size (PlannerInfo *root, RelOptInfo *rel, List *param_clauses) |
double | get_parameterized_joinrel_size (PlannerInfo *root, RelOptInfo *rel, Path *outer_path, Path *inner_path, SpecialJoinInfo *sjinfo, List *restrict_clauses) |
void | set_joinrel_size_estimates (PlannerInfo *root, RelOptInfo *rel, RelOptInfo *outer_rel, RelOptInfo *inner_rel, SpecialJoinInfo *sjinfo, List *restrictlist) |
void | set_subquery_size_estimates (PlannerInfo *root, RelOptInfo *rel) |
void | set_function_size_estimates (PlannerInfo *root, RelOptInfo *rel) |
void | set_values_size_estimates (PlannerInfo *root, RelOptInfo *rel) |
void | set_cte_size_estimates (PlannerInfo *root, RelOptInfo *rel, double cte_rows) |
void | set_tablefunc_size_estimates (PlannerInfo *root, RelOptInfo *rel) |
void | set_namedtuplestore_size_estimates (PlannerInfo *root, RelOptInfo *rel) |
void | set_result_size_estimates (PlannerInfo *root, RelOptInfo *rel) |
void | set_foreign_size_estimates (PlannerInfo *root, RelOptInfo *rel) |
PathTarget * | set_pathtarget_cost_width (PlannerInfo *root, PathTarget *target) |
double | compute_bitmap_pages (PlannerInfo *root, RelOptInfo *baserel, Path *bitmapqual, double loop_count, Cost *cost_p, double *tuples_p) |
double | compute_gather_rows (Path *path) |
#define DEFAULT_EFFECTIVE_CACHE_SIZE 524288 /* measured in pages */ |
double compute_bitmap_pages | ( | PlannerInfo * | root, |
RelOptInfo * | baserel, | ||
Path * | bitmapqual, | ||
double | loop_count, | ||
Cost * | cost_p, | ||
double * | tuples_p | ||
) |
Definition at line 6489 of file costsize.c.
References clamp_row_est(), cost_bitmap_tree_node(), get_indexpath_pages(), index_pages_fetched(), Max, Min, RelOptInfo::pages, root, T, tbm_calculate_entries(), RelOptInfo::tuples, and work_mem.
Referenced by cost_bitmap_heap_scan(), and create_partial_bitmap_paths().
double compute_gather_rows | ( | Path * | path | ) |
Definition at line 6600 of file costsize.c.
References Assert, clamp_row_est(), get_parallel_divisor(), Path::parallel_workers, and Path::rows.
Referenced by create_ordered_paths(), gather_grouping_paths(), generate_gather_paths(), and generate_useful_gather_paths().
void compute_semi_anti_join_factors | ( | PlannerInfo * | root, |
RelOptInfo * | joinrel, | ||
RelOptInfo * | outerrel, | ||
RelOptInfo * | innerrel, | ||
JoinType | jointype, | ||
SpecialJoinInfo * | sjinfo, | ||
List * | restrictlist, | ||
SemiAntiJoinFactors * | semifactors | ||
) |
Definition at line 5090 of file costsize.c.
References clauselist_selectivity(), init_dummy_sjinfo(), IS_OUTER_JOIN, JOIN_ANTI, JOIN_INNER, JOIN_SEMI, lappend(), lfirst_node, list_free(), SemiAntiJoinFactors::match_count, Max, NIL, SemiAntiJoinFactors::outer_match_frac, RelOptInfo::relids, RINFO_IS_PUSHED_DOWN, root, and RelOptInfo::rows.
Referenced by add_paths_to_joinrel().
void cost_agg | ( | Path * | path, |
PlannerInfo * | root, | ||
AggStrategy | aggstrategy, | ||
const AggClauseCosts * | aggcosts, | ||
int | numGroupCols, | ||
double | numGroups, | ||
List * | quals, | ||
int | input_disabled_nodes, | ||
Cost | input_startup_cost, | ||
Cost | input_total_cost, | ||
double | input_tuples, | ||
double | input_width | ||
) |
Definition at line 2682 of file costsize.c.
References AGG_HASHED, AGG_MIXED, AGG_PLAIN, AGG_SORTED, Assert, clamp_row_est(), clauselist_selectivity(), cost_qual_eval(), cpu_operator_cost, cpu_tuple_cost, Path::disabled_nodes, enable_hashagg, AggClauseCosts::finalCost, hash_agg_entry_size(), hash_agg_set_limits(), JOIN_INNER, list_length(), Max, MemSet, QualCost::per_tuple, random_page_cost, relation_byte_size(), root, Path::rows, seq_page_cost, QualCost::startup, Path::startup_cost, Path::total_cost, AggClauseCosts::transCost, and AggClauseCosts::transitionSpace.
Referenced by choose_hashed_setop(), create_agg_path(), create_groupingsets_path(), and create_unique_path().
void cost_append | ( | AppendPath * | apath | ) |
Definition at line 2250 of file costsize.c.
References APPEND_CPU_COST_MULTIPLIER, append_nonpartial_cost(), Assert, clamp_row_est(), cost_sort(), cpu_tuple_cost, Path::disabled_nodes, AppendPath::first_partial_path, get_parallel_divisor(), i, lfirst, AppendPath::limit_tuples, linitial, Min, NIL, Path::parallel_aware, Path::parallel_workers, AppendPath::path, Path::pathkeys, pathkeys_contained_in(), Path::rows, Path::startup_cost, subpath(), AppendPath::subpaths, Path::total_cost, and work_mem.
Referenced by create_append_path().
void cost_bitmap_and_node | ( | BitmapAndPath * | path, |
PlannerInfo * | root | ||
) |
Definition at line 1165 of file costsize.c.
References BitmapAndPath::bitmapquals, BitmapAndPath::bitmapselectivity, cost_bitmap_tree_node(), cpu_operator_cost, Path::disabled_nodes, lfirst, list_head(), BitmapAndPath::path, Path::rows, Path::startup_cost, subpath(), and Path::total_cost.
Referenced by create_bitmap_and_path().
void cost_bitmap_heap_scan | ( | Path * | path, |
PlannerInfo * | root, | ||
RelOptInfo * | baserel, | ||
ParamPathInfo * | param_info, | ||
Path * | bitmapqual, | ||
double | loop_count | ||
) |
Definition at line 1023 of file costsize.c.
References Assert, clamp_row_est(), compute_bitmap_pages(), cpu_tuple_cost, Path::disabled_nodes, enable_bitmapscan, get_parallel_divisor(), get_restriction_qual_cost(), get_tablespace_page_costs(), IsA, RelOptInfo::pages, Path::parallel_workers, QualCost::per_tuple, ParamPathInfo::ppi_rows, RelOptInfo::relid, RelOptInfo::reltablespace, root, RelOptInfo::rows, Path::rows, RTE_RELATION, RelOptInfo::rtekind, QualCost::startup, Path::startup_cost, T, and Path::total_cost.
Referenced by bitmap_scan_cost_est(), and create_bitmap_heap_path().
void cost_bitmap_or_node | ( | BitmapOrPath * | path, |
PlannerInfo * | root | ||
) |
Definition at line 1210 of file costsize.c.
References BitmapOrPath::bitmapquals, BitmapOrPath::bitmapselectivity, cost_bitmap_tree_node(), cpu_operator_cost, IsA, lfirst, list_head(), Min, BitmapOrPath::path, Path::rows, Path::startup_cost, subpath(), and Path::total_cost.
Referenced by create_bitmap_or_path().
void cost_bitmap_tree_node | ( | Path * | path, |
Cost * | cost, | ||
Selectivity * | selec | ||
) |
Definition at line 1122 of file costsize.c.
References cpu_operator_cost, elog, ERROR, IsA, nodeTag, Path::rows, and Path::total_cost.
Referenced by choose_bitmap_and(), compute_bitmap_pages(), cost_bitmap_and_node(), cost_bitmap_or_node(), and path_usage_comparator().
void cost_ctescan | ( | Path * | path, |
PlannerInfo * | root, | ||
RelOptInfo * | baserel, | ||
ParamPathInfo * | param_info | ||
) |
Definition at line 1708 of file costsize.c.
References Assert, cpu_tuple_cost, Path::disabled_nodes, get_restriction_qual_cost(), QualCost::per_tuple, ParamPathInfo::ppi_rows, RelOptInfo::relid, root, RelOptInfo::rows, Path::rows, RTE_CTE, RelOptInfo::rtekind, QualCost::startup, Path::startup_cost, Path::total_cost, and RelOptInfo::tuples.
Referenced by create_ctescan_path(), and create_worktablescan_path().
void cost_functionscan | ( | Path * | path, |
PlannerInfo * | root, | ||
RelOptInfo * | baserel, | ||
ParamPathInfo * | param_info | ||
) |
Definition at line 1538 of file costsize.c.
References Assert, cost_qual_eval_node(), cpu_tuple_cost, Path::disabled_nodes, RangeTblEntry::functions, get_restriction_qual_cost(), QualCost::per_tuple, planner_rt_fetch, ParamPathInfo::ppi_rows, RelOptInfo::relid, root, RelOptInfo::rows, Path::rows, RTE_FUNCTION, RangeTblEntry::rtekind, QualCost::startup, Path::startup_cost, Path::total_cost, and RelOptInfo::tuples.
Referenced by create_functionscan_path().
void cost_gather | ( | GatherPath * | path, |
PlannerInfo * | root, | ||
RelOptInfo * | rel, | ||
ParamPathInfo * | param_info, | ||
double * | rows | ||
) |
Definition at line 446 of file costsize.c.
References Path::disabled_nodes, parallel_setup_cost, parallel_tuple_cost, GatherPath::path, ParamPathInfo::ppi_rows, RelOptInfo::rows, Path::rows, Path::startup_cost, GatherPath::subpath, and Path::total_cost.
Referenced by create_gather_path().
void cost_gather_merge | ( | GatherMergePath * | path, |
PlannerInfo * | root, | ||
RelOptInfo * | rel, | ||
ParamPathInfo * | param_info, | ||
int | input_disabled_nodes, | ||
Cost | input_startup_cost, | ||
Cost | input_total_cost, | ||
double * | rows | ||
) |
Definition at line 485 of file costsize.c.
References Assert, cpu_operator_cost, Path::disabled_nodes, enable_gathermerge, LOG2, GatherMergePath::num_workers, parallel_setup_cost, parallel_tuple_cost, GatherMergePath::path, ParamPathInfo::ppi_rows, RelOptInfo::rows, Path::rows, Path::startup_cost, and Path::total_cost.
Referenced by create_gather_merge_path().
void cost_group | ( | Path * | path, |
PlannerInfo * | root, | ||
int | numGroupCols, | ||
double | numGroups, | ||
List * | quals, | ||
int | input_disabled_nodes, | ||
Cost | input_startup_cost, | ||
Cost | input_total_cost, | ||
double | input_tuples | ||
) |
Definition at line 3196 of file costsize.c.
References clamp_row_est(), clauselist_selectivity(), cost_qual_eval(), cpu_operator_cost, Path::disabled_nodes, JOIN_INNER, QualCost::per_tuple, root, Path::rows, QualCost::startup, Path::startup_cost, and Path::total_cost.
Referenced by choose_hashed_setop(), and create_group_path().
void cost_incremental_sort | ( | Path * | path, |
PlannerInfo * | root, | ||
List * | pathkeys, | ||
int | presorted_keys, | ||
int | input_disabled_nodes, | ||
Cost | input_startup_cost, | ||
Cost | input_total_cost, | ||
double | input_tuples, | ||
int | width, | ||
Cost | comparison_cost, | ||
int | sort_mem, | ||
double | limit_tuples | ||
) |
Definition at line 2000 of file costsize.c.
References Assert, bms_is_member(), cost_tuplesort(), cpu_tuple_cost, DEFAULT_NUM_DISTINCT, Path::disabled_nodes, EquivalenceMember::em_expr, enable_incremental_sort, estimate_num_groups(), foreach_current_index, sort-test::key, lappend(), lfirst, linitial, list_length(), Min, NIL, pull_varnos(), root, Path::rows, Path::startup_cost, and Path::total_cost.
Referenced by create_incremental_sort_path(), initial_cost_mergejoin(), and label_incrementalsort_with_costsize().
void cost_index | ( | IndexPath * | path, |
PlannerInfo * | root, | ||
double | loop_count, | ||
bool | partial_path | ||
) |
Definition at line 560 of file costsize.c.
References RelOptInfo::allvisfrac, Assert, clamp_row_est(), compute_parallel_worker(), cost_qual_eval(), cpu_tuple_cost, Path::disabled_nodes, enable_indexscan, extract_nonindex_conditions(), get_parallel_divisor(), get_tablespace_page_costs(), index_pages_fetched(), IndexPath::indexclauses, IndexPath::indexinfo, IndexPath::indexselectivity, IndexPath::indextotalcost, IndexOptInfo::indrestrictinfo, IsA, list_concat(), max_parallel_workers_per_gather, RelOptInfo::pages, Path::parallel_aware, Path::parallel_workers, IndexPath::path, Path::pathtype, QualCost::per_tuple, RelOptInfo::relid, RelOptInfo::reltablespace, root, RelOptInfo::rows, Path::rows, RTE_RELATION, RelOptInfo::rtekind, QualCost::startup, Path::startup_cost, Path::total_cost, and RelOptInfo::tuples.
Referenced by create_index_path(), and reparameterize_path().
void cost_material | ( | Path * | path, |
int | input_disabled_nodes, | ||
Cost | input_startup_cost, | ||
Cost | input_total_cost, | ||
double | tuples, | ||
int | width | ||
) |
Definition at line 2483 of file costsize.c.
References cpu_operator_cost, Path::disabled_nodes, enable_material, relation_byte_size(), Path::rows, seq_page_cost, Path::startup_cost, Path::total_cost, and work_mem.
Referenced by create_material_path(), and materialize_finished_plan().
void cost_merge_append | ( | Path * | path, |
PlannerInfo * | root, | ||
List * | pathkeys, | ||
int | n_streams, | ||
int | input_disabled_nodes, | ||
Cost | input_startup_cost, | ||
Cost | input_total_cost, | ||
double | tuples | ||
) |
Definition at line 2432 of file costsize.c.
References APPEND_CPU_COST_MULTIPLIER, cpu_operator_cost, cpu_tuple_cost, Path::disabled_nodes, LOG2, Path::startup_cost, and Path::total_cost.
Referenced by create_merge_append_path().
void cost_namedtuplestorescan | ( | Path * | path, |
PlannerInfo * | root, | ||
RelOptInfo * | baserel, | ||
ParamPathInfo * | param_info | ||
) |
Definition at line 1750 of file costsize.c.
References Assert, cpu_tuple_cost, Path::disabled_nodes, get_restriction_qual_cost(), QualCost::per_tuple, ParamPathInfo::ppi_rows, RelOptInfo::relid, root, RelOptInfo::rows, Path::rows, RTE_NAMEDTUPLESTORE, RelOptInfo::rtekind, QualCost::startup, Path::startup_cost, Path::total_cost, and RelOptInfo::tuples.
Referenced by create_namedtuplestorescan_path().
void cost_qual_eval | ( | QualCost * | cost, |
List * | quals, | ||
PlannerInfo * | root | ||
) |
Definition at line 4732 of file costsize.c.
References context, cost_qual_eval_walker(), lfirst, and root.
Referenced by add_foreign_grouping_paths(), cost_agg(), cost_group(), cost_index(), cost_subplan(), cost_tidrangescan(), cost_tidscan(), create_group_result_path(), create_minmaxagg_path(), estimate_path_cost_size(), final_cost_hashjoin(), final_cost_mergejoin(), final_cost_nestloop(), get_restriction_qual_cost(), inline_function(), plan_cluster_use_sort(), postgresGetForeignJoinPaths(), postgresGetForeignRelSize(), set_baserel_size_estimates(), and set_foreign_size_estimates().
void cost_qual_eval_node | ( | QualCost * | cost, |
Node * | qual, | ||
PlannerInfo * | root | ||
) |
Definition at line 4758 of file costsize.c.
References context, cost_qual_eval_walker(), and root.
Referenced by add_placeholders_to_joinrel(), cost_functionscan(), cost_qual_eval_walker(), cost_tablefuncscan(), cost_windowagg(), find_simplified_clause(), get_agg_clause_costs(), index_other_operands_eval_cost(), make_sort_input_target(), order_qual_clauses(), set_pathtarget_cost_width(), and set_rel_width().
Definition at line 1826 of file costsize.c.
References cpu_tuple_cost, Path::disabled_nodes, Max, Path::rows, Path::startup_cost, and Path::total_cost.
Referenced by create_recursiveunion_path().
void cost_resultscan | ( | Path * | path, |
PlannerInfo * | root, | ||
RelOptInfo * | baserel, | ||
ParamPathInfo * | param_info | ||
) |
Definition at line 1788 of file costsize.c.
References Assert, cpu_tuple_cost, Path::disabled_nodes, get_restriction_qual_cost(), QualCost::per_tuple, ParamPathInfo::ppi_rows, RelOptInfo::relid, root, RelOptInfo::rows, Path::rows, RTE_RESULT, RelOptInfo::rtekind, QualCost::startup, Path::startup_cost, Path::total_cost, and RelOptInfo::tuples.
Referenced by create_resultscan_path().
void cost_samplescan | ( | Path * | path, |
PlannerInfo * | root, | ||
RelOptInfo * | baserel, | ||
ParamPathInfo * | param_info | ||
) |
Definition at line 370 of file costsize.c.
References Assert, cpu_tuple_cost, Path::disabled_nodes, get_restriction_qual_cost(), get_tablespace_page_costs(), GetTsmRoutine(), TsmRoutine::NextSampleBlock, RelOptInfo::pages, QualCost::per_tuple, planner_rt_fetch, ParamPathInfo::ppi_rows, RelOptInfo::relid, RelOptInfo::reltablespace, root, RelOptInfo::rows, Path::rows, RTE_RELATION, RangeTblEntry::rtekind, QualCost::startup, Path::startup_cost, RangeTblEntry::tablesample, Path::total_cost, TableSampleClause::tsmhandler, and RelOptInfo::tuples.
Referenced by create_samplescan_path().
void cost_seqscan | ( | Path * | path, |
PlannerInfo * | root, | ||
RelOptInfo * | baserel, | ||
ParamPathInfo * | param_info | ||
) |
Definition at line 295 of file costsize.c.
References Assert, clamp_row_est(), cpu_tuple_cost, Path::disabled_nodes, enable_seqscan, get_parallel_divisor(), get_restriction_qual_cost(), get_tablespace_page_costs(), RelOptInfo::pages, Path::parallel_workers, QualCost::per_tuple, ParamPathInfo::ppi_rows, RelOptInfo::relid, RelOptInfo::reltablespace, root, RelOptInfo::rows, Path::rows, RTE_RELATION, RelOptInfo::rtekind, QualCost::startup, Path::startup_cost, Path::total_cost, and RelOptInfo::tuples.
Referenced by create_seqscan_path().
void cost_sort | ( | Path * | path, |
PlannerInfo * | root, | ||
List * | pathkeys, | ||
int | disabled_nodes, | ||
Cost | input_cost, | ||
double | tuples, | ||
int | width, | ||
Cost | comparison_cost, | ||
int | sort_mem, | ||
double | limit_tuples | ||
) |
Definition at line 2144 of file costsize.c.
References cost_tuplesort(), Path::disabled_nodes, enable_sort, Path::rows, Path::startup_cost, and Path::total_cost.
Referenced by adjust_foreign_grouping_path_cost(), choose_hashed_setop(), cost_append(), create_groupingsets_path(), create_merge_append_path(), create_sort_path(), create_unique_path(), initial_cost_mergejoin(), label_sort_with_costsize(), and plan_cluster_use_sort().
void cost_subplan | ( | PlannerInfo * | root, |
SubPlan * | subplan, | ||
Plan * | plan | ||
) |
Definition at line 4524 of file costsize.c.
References ALL_SUBLINK, ANY_SUBLINK, clamp_row_est(), cost_qual_eval(), cpu_operator_cost, ExecMaterializesOutput(), EXISTS_SUBLINK, make_ands_implicit(), NIL, nodeTag, SubPlan::parParam, SubPlan::per_call_cost, QualCost::per_tuple, plan, root, QualCost::startup, SubPlan::startup_cost, SubPlan::subLinkType, SubPlan::testexpr, and SubPlan::useHashTable.
Referenced by build_subplan(), SS_make_initplan_from_plan(), and SS_process_ctes().
void cost_subqueryscan | ( | SubqueryScanPath * | path, |
PlannerInfo * | root, | ||
RelOptInfo * | baserel, | ||
ParamPathInfo * | param_info, | ||
bool | trivial_pathtarget | ||
) |
Definition at line 1457 of file costsize.c.
References Assert, RelOptInfo::baserestrictinfo, clamp_row_est(), clauselist_selectivity(), cpu_tuple_cost, Path::disabled_nodes, get_restriction_qual_cost(), JOIN_INNER, list_concat_copy(), NIL, SubqueryScanPath::path, QualCost::per_tuple, ParamPathInfo::ppi_clauses, RelOptInfo::relid, root, Path::rows, RTE_SUBQUERY, RelOptInfo::rtekind, QualCost::startup, Path::startup_cost, SubqueryScanPath::subpath, and Path::total_cost.
Referenced by create_subqueryscan_path().
void cost_tablefuncscan | ( | Path * | path, |
PlannerInfo * | root, | ||
RelOptInfo * | baserel, | ||
ParamPathInfo * | param_info | ||
) |
Definition at line 1600 of file costsize.c.
References Assert, cost_qual_eval_node(), cpu_tuple_cost, Path::disabled_nodes, get_restriction_qual_cost(), QualCost::per_tuple, planner_rt_fetch, ParamPathInfo::ppi_rows, RelOptInfo::relid, root, RelOptInfo::rows, Path::rows, RTE_TABLEFUNC, RangeTblEntry::rtekind, QualCost::startup, Path::startup_cost, RangeTblEntry::tablefunc, Path::total_cost, and RelOptInfo::tuples.
Referenced by create_tablefuncscan_path().
void cost_tidrangescan | ( | Path * | path, |
PlannerInfo * | root, | ||
RelOptInfo * | baserel, | ||
List * | tidrangequals, | ||
ParamPathInfo * | param_info | ||
) |
Definition at line 1363 of file costsize.c.
References Assert, clauselist_selectivity(), cost_qual_eval(), cpu_tuple_cost, Path::disabled_nodes, enable_tidscan, get_restriction_qual_cost(), get_tablespace_page_costs(), JOIN_INNER, RelOptInfo::pages, QualCost::per_tuple, ParamPathInfo::ppi_rows, RelOptInfo::relid, RelOptInfo::reltablespace, root, RelOptInfo::rows, Path::rows, RTE_RELATION, RelOptInfo::rtekind, QualCost::startup, Path::startup_cost, Path::total_cost, and RelOptInfo::tuples.
Referenced by create_tidrangescan_path().
void cost_tidscan | ( | Path * | path, |
PlannerInfo * | root, | ||
RelOptInfo * | baserel, | ||
List * | tidquals, | ||
ParamPathInfo * | param_info | ||
) |
Definition at line 1258 of file costsize.c.
References ScalarArrayOpExpr::args, Assert, RestrictInfo::clause, cost_qual_eval(), cpu_tuple_cost, Path::disabled_nodes, enable_tidscan, estimate_array_length(), get_restriction_qual_cost(), get_tablespace_page_costs(), IsA, lfirst_node, list_length(), lsecond, NIL, QualCost::per_tuple, ParamPathInfo::ppi_rows, RelOptInfo::relid, RelOptInfo::reltablespace, root, RelOptInfo::rows, Path::rows, RTE_RELATION, RelOptInfo::rtekind, QualCost::startup, Path::startup_cost, and Path::total_cost.
Referenced by create_tidscan_path().
void cost_valuesscan | ( | Path * | path, |
PlannerInfo * | root, | ||
RelOptInfo * | baserel, | ||
ParamPathInfo * | param_info | ||
) |
Definition at line 1657 of file costsize.c.
References Assert, cpu_operator_cost, cpu_tuple_cost, Path::disabled_nodes, get_restriction_qual_cost(), QualCost::per_tuple, ParamPathInfo::ppi_rows, RelOptInfo::relid, root, RelOptInfo::rows, Path::rows, RTE_VALUES, RelOptInfo::rtekind, QualCost::startup, Path::startup_cost, Path::total_cost, and RelOptInfo::tuples.
Referenced by create_valuesscan_path().
void cost_windowagg | ( | Path * | path, |
PlannerInfo * | root, | ||
List * | windowFuncs, | ||
WindowClause * | winclause, | ||
int | input_disabled_nodes, | ||
Cost | input_startup_cost, | ||
Cost | input_total_cost, | ||
double | input_tuples | ||
) |
Definition at line 3099 of file costsize.c.
References add_function_cost(), WindowFunc::aggfilter, WindowFunc::args, cost_qual_eval_node(), cpu_operator_cost, cpu_tuple_cost, Path::disabled_nodes, get_windowclause_startup_tuples(), lfirst_node, list_length(), WindowClause::orderClause, WindowClause::partitionClause, QualCost::per_tuple, root, Path::rows, QualCost::startup, Path::startup_cost, Path::total_cost, and WindowFunc::winfnoid.
Referenced by create_windowagg_path().
void final_cost_hashjoin | ( | PlannerInfo * | root, |
HashPath * | path, | ||
JoinCostWorkspace * | workspace, | ||
JoinPathExtraData * | extra | ||
) |
Definition at line 4275 of file costsize.c.
References approx_tuple_count(), Assert, bms_is_subset(), clamp_row_est(), RestrictInfo::clause, cost_qual_eval(), cpu_tuple_cost, disable_cost, JoinCostWorkspace::disabled_nodes, estimate_hash_bucket_stats(), get_hash_memory_limit(), get_leftop(), get_parallel_divisor(), get_rightop(), HashPath::inner_rows_total, JoinCostWorkspace::inner_rows_total, JoinPathExtraData::inner_unique, JoinPath::innerjoinpath, IsA, JOIN_ANTI, JOIN_SEMI, JoinPath::joinrestrictinfo, JoinPath::jointype, HashPath::jpath, lfirst_node, SemiAntiJoinFactors::match_count, HashPath::num_batches, JoinCostWorkspace::numbatches, JoinCostWorkspace::numbuckets, SemiAntiJoinFactors::outer_match_frac, JoinPath::outerjoinpath, HashPath::path_hashclauses, QualCost::per_tuple, relation_byte_size(), root, Path::rows, JoinCostWorkspace::run_cost, JoinPathExtraData::semifactors, QualCost::startup, and JoinCostWorkspace::startup_cost.
Referenced by create_hashjoin_path().
void final_cost_mergejoin | ( | PlannerInfo * | root, |
MergePath * | path, | ||
JoinCostWorkspace * | workspace, | ||
JoinPathExtraData * | extra | ||
) |
Definition at line 3837 of file costsize.c.
References approx_tuple_count(), clamp_row_est(), cost_qual_eval(), cpu_operator_cost, cpu_tuple_cost, JoinCostWorkspace::disabled_nodes, enable_material, ExecSupportsMarkRestore(), get_parallel_divisor(), if(), JoinCostWorkspace::inner_rows, JoinCostWorkspace::inner_run_cost, JoinCostWorkspace::inner_skip_rows, JoinPathExtraData::inner_unique, JoinPath::innerjoinpath, MergePath::innersortkeys, IsA, JOIN_ANTI, JOIN_SEMI, JoinPath::joinrestrictinfo, JoinPath::jointype, MergePath::jpath, list_length(), MergePath::materialize_inner, NIL, JoinCostWorkspace::outer_rows, JoinCostWorkspace::outer_skip_rows, JoinPath::outerjoinpath, MergePath::path_mergeclauses, QualCost::per_tuple, relation_byte_size(), root, Path::rows, JoinCostWorkspace::run_cost, MergePath::skip_mark_restore, QualCost::startup, JoinCostWorkspace::startup_cost, and work_mem.
Referenced by create_mergejoin_path().
void final_cost_nestloop | ( | PlannerInfo * | root, |
NestPath * | path, | ||
JoinCostWorkspace * | workspace, | ||
JoinPathExtraData * | extra | ||
) |
Definition at line 3350 of file costsize.c.
References clamp_row_est(), cost_qual_eval(), cpu_tuple_cost, JoinCostWorkspace::disabled_nodes, get_parallel_divisor(), has_indexed_join_quals(), JoinCostWorkspace::inner_rescan_run_cost, JoinCostWorkspace::inner_run_cost, JoinPathExtraData::inner_unique, JoinPath::innerjoinpath, JOIN_ANTI, JOIN_SEMI, JoinPath::joinrestrictinfo, JoinPath::jointype, NestPath::jpath, SemiAntiJoinFactors::match_count, SemiAntiJoinFactors::outer_match_frac, JoinPath::outerjoinpath, QualCost::per_tuple, root, Path::rows, JoinCostWorkspace::run_cost, JoinPathExtraData::semifactors, QualCost::startup, and JoinCostWorkspace::startup_cost.
Referenced by create_nestloop_path().
double get_parameterized_baserel_size | ( | PlannerInfo * | root, |
RelOptInfo * | rel, | ||
List * | param_clauses | ||
) |
Definition at line 5355 of file costsize.c.
References RelOptInfo::baserestrictinfo, clamp_row_est(), clauselist_selectivity(), JOIN_INNER, list_concat_copy(), RelOptInfo::relid, root, RelOptInfo::rows, and RelOptInfo::tuples.
Referenced by get_baserel_parampathinfo().
double get_parameterized_joinrel_size | ( | PlannerInfo * | root, |
RelOptInfo * | rel, | ||
Path * | outer_path, | ||
Path * | inner_path, | ||
SpecialJoinInfo * | sjinfo, | ||
List * | restrict_clauses | ||
) |
Definition at line 5436 of file costsize.c.
References calc_joinrel_size_estimate(), root, RelOptInfo::rows, and Path::rows.
Referenced by get_joinrel_parampathinfo().
double index_pages_fetched | ( | double | tuples_fetched, |
BlockNumber | pages, | ||
double | index_pages, | ||
PlannerInfo * | root | ||
) |
Definition at line 908 of file costsize.c.
References Assert, b, effective_cache_size, Max, root, and T.
Referenced by compute_bitmap_pages(), cost_index(), genericcostestimate(), and gincostestimate().
void initial_cost_hashjoin | ( | PlannerInfo * | root, |
JoinCostWorkspace * | workspace, | ||
JoinType | jointype, | ||
List * | hashclauses, | ||
Path * | outer_path, | ||
Path * | inner_path, | ||
JoinPathExtraData * | extra, | ||
bool | parallel_hash | ||
) |
Definition at line 4160 of file costsize.c.
References cpu_operator_cost, cpu_tuple_cost, Path::disabled_nodes, JoinCostWorkspace::disabled_nodes, enable_hashjoin, ExecChooseHashTableSize(), get_parallel_divisor(), JoinCostWorkspace::inner_rows_total, list_length(), JoinCostWorkspace::numbatches, JoinCostWorkspace::numbuckets, page_size(), Path::parallel_workers, Path::rows, JoinCostWorkspace::run_cost, seq_page_cost, Path::startup_cost, JoinCostWorkspace::startup_cost, Path::total_cost, and JoinCostWorkspace::total_cost.
Referenced by try_hashjoin_path(), and try_partial_hashjoin_path().
void initial_cost_mergejoin | ( | PlannerInfo * | root, |
JoinCostWorkspace * | workspace, | ||
JoinType | jointype, | ||
List * | mergeclauses, | ||
Path * | outer_path, | ||
Path * | inner_path, | ||
List * | outersortkeys, | ||
List * | innersortkeys, | ||
JoinPathExtraData * | extra | ||
) |
Definition at line 3552 of file costsize.c.
References Assert, bms_is_subset(), cached_scansel(), clamp_row_est(), cost_incremental_sort(), cost_sort(), Path::disabled_nodes, JoinCostWorkspace::disabled_nodes, elog, enable_incremental_sort, enable_mergejoin, ERROR, JoinCostWorkspace::inner_rows, JoinCostWorkspace::inner_run_cost, JoinCostWorkspace::inner_skip_rows, JOIN_ANTI, JOIN_FULL, JOIN_LEFT, JOIN_RIGHT, JOIN_RIGHT_ANTI, MergeScanSelCache::leftendsel, MergeScanSelCache::leftstartsel, linitial, JoinCostWorkspace::outer_rows, JoinCostWorkspace::outer_skip_rows, Path::pathkeys, pathkeys_count_contained_in(), PG_USED_FOR_ASSERTS_ONLY, PathKey::pk_nulls_first, PathKey::pk_opfamily, PathKey::pk_strategy, MergeScanSelCache::rightendsel, MergeScanSelCache::rightstartsel, root, Path::rows, JoinCostWorkspace::run_cost, Path::startup_cost, JoinCostWorkspace::startup_cost, Path::total_cost, JoinCostWorkspace::total_cost, and work_mem.
Referenced by try_mergejoin_path(), and try_partial_mergejoin_path().
void initial_cost_nestloop | ( | PlannerInfo * | root, |
JoinCostWorkspace * | workspace, | ||
JoinType | jointype, | ||
Path * | outer_path, | ||
Path * | inner_path, | ||
JoinPathExtraData * | extra | ||
) |
Definition at line 3268 of file costsize.c.
References cost_rescan(), Path::disabled_nodes, JoinCostWorkspace::disabled_nodes, enable_nestloop, JoinCostWorkspace::inner_rescan_run_cost, JoinCostWorkspace::inner_run_cost, JoinPathExtraData::inner_unique, JOIN_ANTI, JOIN_SEMI, root, Path::rows, JoinCostWorkspace::run_cost, Path::startup_cost, JoinCostWorkspace::startup_cost, Path::total_cost, and JoinCostWorkspace::total_cost.
Referenced by try_nestloop_path(), and try_partial_nestloop_path().
void set_baserel_size_estimates | ( | PlannerInfo * | root, |
RelOptInfo * | rel | ||
) |
Definition at line 5325 of file costsize.c.
References Assert, RelOptInfo::baserestrictcost, RelOptInfo::baserestrictinfo, clamp_row_est(), clauselist_selectivity(), cost_qual_eval(), JOIN_INNER, RelOptInfo::relid, root, RelOptInfo::rows, set_rel_width(), and RelOptInfo::tuples.
Referenced by postgresGetForeignRelSize(), set_cte_size_estimates(), set_function_size_estimates(), set_namedtuplestore_size_estimates(), set_plain_rel_size(), set_result_size_estimates(), set_subquery_size_estimates(), set_tablefunc_size_estimates(), set_tablesample_rel_size(), and set_values_size_estimates().
void set_cte_size_estimates | ( | PlannerInfo * | root, |
RelOptInfo * | rel, | ||
double | cte_rows | ||
) |
Definition at line 6050 of file costsize.c.
References Assert, clamp_row_est(), planner_rt_fetch, recursive_worktable_factor, RelOptInfo::relid, root, RTE_CTE, RangeTblEntry::rtekind, set_baserel_size_estimates(), and RelOptInfo::tuples.
Referenced by set_cte_pathlist(), and set_worktable_pathlist().
void set_foreign_size_estimates | ( | PlannerInfo * | root, |
RelOptInfo * | rel | ||
) |
Definition at line 6150 of file costsize.c.
References Assert, RelOptInfo::baserestrictcost, RelOptInfo::baserestrictinfo, cost_qual_eval(), RelOptInfo::relid, root, RelOptInfo::rows, and set_rel_width().
Referenced by set_foreign_size().
void set_function_size_estimates | ( | PlannerInfo * | root, |
RelOptInfo * | rel | ||
) |
Definition at line 5958 of file costsize.c.
References Assert, expression_returns_set_rows(), RangeTblFunction::funcexpr, RangeTblEntry::functions, lfirst, planner_rt_fetch, RelOptInfo::relid, root, RTE_FUNCTION, RangeTblEntry::rtekind, set_baserel_size_estimates(), and RelOptInfo::tuples.
Referenced by set_rel_size().
void set_joinrel_size_estimates | ( | PlannerInfo * | root, |
RelOptInfo * | rel, | ||
RelOptInfo * | outer_rel, | ||
RelOptInfo * | inner_rel, | ||
SpecialJoinInfo * | sjinfo, | ||
List * | restrictlist | ||
) |
Definition at line 5404 of file costsize.c.
References calc_joinrel_size_estimate(), root, and RelOptInfo::rows.
Referenced by build_child_join_rel(), and build_join_rel().
void set_namedtuplestore_size_estimates | ( | PlannerInfo * | root, |
RelOptInfo * | rel | ||
) |
Definition at line 6088 of file costsize.c.
References Assert, planner_rt_fetch, RelOptInfo::relid, root, RTE_NAMEDTUPLESTORE, RangeTblEntry::rtekind, set_baserel_size_estimates(), and RelOptInfo::tuples.
Referenced by set_namedtuplestore_pathlist().
PathTarget* set_pathtarget_cost_width | ( | PlannerInfo * | root, |
PathTarget * | target | ||
) |
Definition at line 6342 of file costsize.c.
References clamp_width_est(), PathTarget::cost, cost_qual_eval_node(), PathTarget::exprs, get_expr_width(), IsA, lfirst, QualCost::per_tuple, root, QualCost::startup, and PathTarget::width.
Referenced by make_group_input_target(), make_partial_grouping_target(), make_sort_input_target(), make_window_input_target(), and split_pathtarget_at_srfs().
void set_result_size_estimates | ( | PlannerInfo * | root, |
RelOptInfo * | rel | ||
) |
Definition at line 6121 of file costsize.c.
References Assert, planner_rt_fetch, RelOptInfo::relid, root, RTE_RESULT, set_baserel_size_estimates(), and RelOptInfo::tuples.
Referenced by set_result_pathlist().
void set_subquery_size_estimates | ( | PlannerInfo * | root, |
RelOptInfo * | rel | ||
) |
Definition at line 5878 of file costsize.c.
References Assert, RelOptInfo::cheapest_total_path, TargetEntry::expr, fetch_upper_rel(), find_base_rel(), if(), IsA, lfirst_node, RelOptInfo::max_attr, RelOptInfo::min_attr, PlannerInfo::parse, planner_rt_fetch, RelOptInfo::relid, TargetEntry::resno, root, Path::rows, RTE_SUBQUERY, set_baserel_size_estimates(), Query::setOperations, RelOptInfo::subroot, Query::targetList, RelOptInfo::tuples, UPPERREL_FINAL, Var::varattno, and Var::varno.
Referenced by build_setop_child_paths(), and set_subquery_pathlist().
void set_tablefunc_size_estimates | ( | PlannerInfo * | root, |
RelOptInfo * | rel | ||
) |
Definition at line 5996 of file costsize.c.
References Assert, planner_rt_fetch, RelOptInfo::relid, root, RTE_TABLEFUNC, set_baserel_size_estimates(), and RelOptInfo::tuples.
Referenced by set_rel_size().
void set_values_size_estimates | ( | PlannerInfo * | root, |
RelOptInfo * | rel | ||
) |
Definition at line 6018 of file costsize.c.
References Assert, list_length(), planner_rt_fetch, RelOptInfo::relid, root, RTE_VALUES, RangeTblEntry::rtekind, set_baserel_size_estimates(), RelOptInfo::tuples, and RangeTblEntry::values_lists.
Referenced by set_rel_size().
|
extern |
Definition at line 57 of file plancat.c.
Referenced by relation_excluded_by_constraints().
|
extern |
Definition at line 141 of file costsize.c.
Referenced by final_cost_hashjoin().
|
extern |
Definition at line 165 of file costsize.c.
Referenced by create_append_plan().
|
extern |
Definition at line 148 of file costsize.c.
Referenced by cost_bitmap_heap_scan().
|
extern |
Definition at line 158 of file costsize.c.
Referenced by cost_gather_merge().
|
extern |
Definition at line 152 of file costsize.c.
Referenced by choose_hashed_setop(), compute_semijoin_info(), cost_agg(), create_final_distinct_paths(), and create_partial_distinct_paths().
|
extern |
Definition at line 157 of file costsize.c.
Referenced by add_paths_to_joinrel(), and initial_cost_hashjoin().
|
extern |
Definition at line 151 of file costsize.c.
Referenced by build_setop_child_paths(), cost_incremental_sort(), create_mergejoin_plan(), create_one_window_path(), create_ordered_paths(), gather_grouping_paths(), generate_useful_gather_paths(), get_useful_group_keys_orderings(), get_useful_pathkeys_for_distinct(), initial_cost_mergejoin(), and make_ordered_path().
|
extern |
Definition at line 147 of file costsize.c.
Referenced by check_index_only().
|
extern |
Definition at line 146 of file costsize.c.
Referenced by cost_index(), and plan_cluster_use_sort().
|
extern |
Definition at line 154 of file costsize.c.
Referenced by build_subplan(), consider_parallel_nestloop(), cost_material(), final_cost_mergejoin(), and match_unsorted_outer().
|
extern |
Definition at line 155 of file costsize.c.
Referenced by create_memoize_path(), and get_memoize_path().
|
extern |
Definition at line 156 of file costsize.c.
Referenced by add_paths_to_joinrel(), and initial_cost_mergejoin().
|
extern |
Definition at line 153 of file costsize.c.
Referenced by initial_cost_nestloop().
|
extern |
Definition at line 161 of file costsize.c.
Referenced by add_paths_to_append_rel(), and generate_union_paths().
|
extern |
Definition at line 162 of file costsize.c.
Referenced by hash_inner_and_outer().
|
extern |
Definition at line 163 of file costsize.c.
Referenced by create_append_plan(), create_merge_append_plan(), and prune_append_rel_partitions().
|
extern |
Definition at line 160 of file costsize.c.
Referenced by create_grouping_paths().
|
extern |
Definition at line 159 of file costsize.c.
Referenced by build_joinrel_partition_info(), and set_append_rel_size().
|
extern |
Definition at line 164 of file costsize.c.
Referenced by adjust_group_pathkeys_for_groupagg().
|
extern |
Definition at line 145 of file costsize.c.
Referenced by cost_seqscan().
|
extern |
Definition at line 150 of file costsize.c.
Referenced by cost_sort(), and make_sort().
|
extern |
Definition at line 149 of file costsize.c.
Referenced by cost_tidrangescan(), cost_tidscan(), and create_tidscan_paths().
|
extern |
Definition at line 143 of file costsize.c.
Referenced by add_paths_to_append_rel(), cost_index(), create_partial_bitmap_paths(), create_plain_partial_paths(), generate_union_paths(), and standard_planner().