PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <limits.h>
#include <math.h>
#include "access/amapi.h"
#include "access/htup_details.h"
#include "access/tsmapi.h"
#include "executor/executor.h"
#include "executor/nodeAgg.h"
#include "executor/nodeHash.h"
#include "executor/nodeMemoize.h"
#include "miscadmin.h"
#include "nodes/makefuncs.h"
#include "nodes/nodeFuncs.h"
#include "optimizer/clauses.h"
#include "optimizer/cost.h"
#include "optimizer/optimizer.h"
#include "optimizer/pathnode.h"
#include "optimizer/paths.h"
#include "optimizer/placeholder.h"
#include "optimizer/plancat.h"
#include "optimizer/restrictinfo.h"
#include "parser/parsetree.h"
#include "utils/lsyscache.h"
#include "utils/selfuncs.h"
#include "utils/spccache.h"
#include "utils/tuplesort.h"
Go to the source code of this file.
Data Structures | |
struct | cost_qual_eval_context |
Macros | |
#define | LOG2(x) (log(x) / 0.693147180559945) |
#define | APPEND_CPU_COST_MULTIPLIER 0.5 |
#define | MAXIMUM_ROWCOUNT 1e100 |
Functions | |
static List * | extract_nonindex_conditions (List *qual_clauses, List *indexclauses) |
static MergeScanSelCache * | cached_scansel (PlannerInfo *root, RestrictInfo *rinfo, PathKey *pathkey) |
static void | cost_rescan (PlannerInfo *root, Path *path, Cost *rescan_startup_cost, Cost *rescan_total_cost) |
static bool | cost_qual_eval_walker (Node *node, cost_qual_eval_context *context) |
static void | get_restriction_qual_cost (PlannerInfo *root, RelOptInfo *baserel, ParamPathInfo *param_info, QualCost *qpqual_cost) |
static bool | has_indexed_join_quals (NestPath *path) |
static double | approx_tuple_count (PlannerInfo *root, JoinPath *path, List *quals) |
static double | calc_joinrel_size_estimate (PlannerInfo *root, RelOptInfo *joinrel, RelOptInfo *outer_rel, RelOptInfo *inner_rel, double outer_rows, double inner_rows, SpecialJoinInfo *sjinfo, List *restrictlist) |
static Selectivity | get_foreign_key_join_selectivity (PlannerInfo *root, Relids outer_relids, Relids inner_relids, SpecialJoinInfo *sjinfo, List **restrictlist) |
static Cost | append_nonpartial_cost (List *subpaths, int numpaths, int parallel_workers) |
static void | set_rel_width (PlannerInfo *root, RelOptInfo *rel) |
static int32 | get_expr_width (PlannerInfo *root, const Node *expr) |
static double | relation_byte_size (double tuples, int width) |
static double | page_size (double tuples, int width) |
static double | get_parallel_divisor (Path *path) |
double | clamp_row_est (double nrows) |
int32 | clamp_width_est (int64 tuple_width) |
long | clamp_cardinality_to_long (Cardinality x) |
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_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_index (IndexPath *path, PlannerInfo *root, double loop_count, bool partial_path) |
double | index_pages_fetched (double tuples_fetched, BlockNumber pages, double index_pages, PlannerInfo *root) |
static double | get_indexpath_pages (Path *bitmapqual) |
void | cost_bitmap_heap_scan (Path *path, PlannerInfo *root, RelOptInfo *baserel, ParamPathInfo *param_info, Path *bitmapqual, double loop_count) |
void | cost_bitmap_tree_node (Path *path, Cost *cost, Selectivity *selec) |
void | cost_bitmap_and_node (BitmapAndPath *path, PlannerInfo *root) |
void | cost_bitmap_or_node (BitmapOrPath *path, PlannerInfo *root) |
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_tablefuncscan (Path *path, PlannerInfo *root, RelOptInfo *baserel, ParamPathInfo *param_info) |
void | cost_valuesscan (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) |
static void | cost_tuplesort (Cost *startup_cost, Cost *run_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_sort (Path *path, PlannerInfo *root, List *pathkeys, int input_disabled_nodes, Cost input_cost, double 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) |
static void | cost_memoize_rescan (PlannerInfo *root, MemoizePath *mpath, Cost *rescan_startup_cost, Cost *rescan_total_cost) |
void | cost_agg (Path *path, PlannerInfo *root, AggStrategy aggstrategy, const AggClauseCosts *aggcosts, int numGroupCols, double numGroups, List *quals, int disabled_nodes, Cost input_startup_cost, Cost input_total_cost, double input_tuples, double input_width) |
static double | get_windowclause_startup_tuples (PlannerInfo *root, WindowClause *wc, double input_tuples) |
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_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) |
void | set_joinrel_size_estimates (PlannerInfo *root, RelOptInfo *rel, RelOptInfo *outer_rel, RelOptInfo *inner_rel, SpecialJoinInfo *sjinfo, List *restrictlist) |
double | get_parameterized_joinrel_size (PlannerInfo *root, RelOptInfo *rel, Path *outer_path, Path *inner_path, SpecialJoinInfo *sjinfo, List *restrict_clauses) |
void | set_subquery_size_estimates (PlannerInfo *root, RelOptInfo *rel) |
void | set_function_size_estimates (PlannerInfo *root, RelOptInfo *rel) |
void | set_tablefunc_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_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 APPEND_CPU_COST_MULTIPLIER 0.5 |
Definition at line 120 of file costsize.c.
Definition at line 113 of file costsize.c.
#define MAXIMUM_ROWCOUNT 1e100 |
Definition at line 128 of file costsize.c.
Definition at line 2174 of file costsize.c.
References for_each_cell, i, lfirst, Min, palloc(), and subpath().
Referenced by cost_append().
|
static |
Definition at line 5280 of file costsize.c.
References clamp_row_est(), clause_selectivity(), init_dummy_sjinfo(), JoinPath::innerjoinpath, JOIN_INNER, lfirst, JoinPath::outerjoinpath, root, and Path::rows.
Referenced by final_cost_hashjoin(), and final_cost_mergejoin().
|
static |
Definition at line 4081 of file costsize.c.
References RestrictInfo::clause, MergeScanSelCache::collation, lappend(), MergeScanSelCache::leftendsel, MergeScanSelCache::leftstartsel, lfirst, MemoryContextSwitchTo(), mergejoinscansel(), MergeScanSelCache::nulls_first, MergeScanSelCache::opfamily, palloc(), PathKey::pk_nulls_first, PathKey::pk_opfamily, PathKey::pk_strategy, MergeScanSelCache::rightendsel, MergeScanSelCache::rightstartsel, root, and MergeScanSelCache::strategy.
Referenced by initial_cost_mergejoin().
|
static |
Definition at line 5477 of file costsize.c.
References clamp_row_est(), clauselist_selectivity(), elog, ERROR, get_foreign_key_join_selectivity(), IS_OUTER_JOIN, JOIN_ANTI, JOIN_FULL, JOIN_INNER, JOIN_LEFT, JOIN_SEMI, SpecialJoinInfo::jointype, lappend(), lfirst_node, list_free(), NIL, RelOptInfo::relids, RINFO_IS_PUSHED_DOWN, and root.
Referenced by get_parameterized_joinrel_size(), and set_joinrel_size_estimates().
long clamp_cardinality_to_long | ( | Cardinality | x | ) |
Definition at line 265 of file costsize.c.
References x.
Referenced by buildSubPlanHash(), create_recursiveunion_plan(), create_setop_plan(), and make_agg().
double clamp_row_est | ( | double | nrows | ) |
Definition at line 213 of file costsize.c.
References MAXIMUM_ROWCOUNT.
Referenced by adjust_limit_rows_costs(), approx_tuple_count(), bernoulli_samplescangetsamplesize(), calc_joinrel_size_estimate(), compute_bitmap_pages(), compute_gather_rows(), cost_agg(), cost_append(), cost_bitmap_heap_scan(), cost_group(), cost_index(), cost_seqscan(), cost_subplan(), cost_subqueryscan(), create_bitmap_subplan(), create_memoize_path(), estimate_array_length(), estimate_hash_bucket_stats(), estimate_num_groups(), estimate_path_cost_size(), estimate_size(), expression_returns_set_rows(), final_cost_hashjoin(), final_cost_mergejoin(), final_cost_nestloop(), get_parameterized_baserel_size(), get_variable_numdistinct(), get_windowclause_startup_tuples(), initial_cost_mergejoin(), set_baserel_size_estimates(), set_cte_size_estimates(), set_foreign_size(), system_rows_samplescangetsamplesize(), system_samplescangetsamplesize(), and system_time_samplescangetsamplesize().
Definition at line 242 of file costsize.c.
References Assert, and MaxAllocSize.
Referenced by add_placeholders_to_joinrel(), build_joinrel_tlist(), create_one_window_path(), get_rel_data_width(), set_pathtarget_cost_width(), and set_rel_width().
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 | 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().
|
static |
Definition at line 2541 of file costsize.c.
References Assert, MemoizePath::calls, cpu_operator_cost, cpu_tuple_cost, MemoizePath::est_entries, estimate_num_groups(), ExecEstimateCacheEntryOverheadBytes(), EstimationInfo::flags, get_expr_width(), get_hash_memory_limit(), lfirst, Max, Min, MemoizePath::param_exprs, PG_UINT32_MAX, relation_byte_size(), root, Path::rows, SELFLAG_USED_DEFAULT, Path::startup_cost, MemoizePath::subpath, and Path::total_cost.
Referenced by cost_rescan().
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().
|
static |
Definition at line 4772 of file costsize.c.
References add_function_cost(), CoerceViaIO::arg, ArrayCoerceExpr::arg, ScalarArrayOpExpr::args, RestrictInfo::clause, context, cost_qual_eval_node(), cpu_operator_cost, ArrayCoerceExpr::elemexpr, elog, ERROR, estimate_array_length(), expression_tree_walker, exprType(), get_opcode(), getTypeInputInfo(), getTypeOutputInfo(), IsA, lfirst_oid, linitial, lsecond, OidIsValid, SubPlan::per_call_cost, QualCost::per_tuple, CoerceViaIO::resulttype, cost_qual_eval_context::root, set_opfuncid(), set_sa_opfuncid(), QualCost::startup, SubPlan::startup_cost, AlternativeSubPlan::subplans, and cost_qual_eval_context::total.
Referenced by cost_qual_eval(), and cost_qual_eval_node().
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().
|
static |
Definition at line 4617 of file costsize.c.
References cost_memoize_rescan(), cpu_operator_cost, cpu_tuple_cost, Path::pathtype, relation_byte_size(), root, seq_page_cost, Path::startup_cost, Path::total_cost, and work_mem.
Referenced by initial_cost_nestloop().
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 | input_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().
|
static |
Definition at line 1898 of file costsize.c.
References cpu_operator_cost, LOG2, random_page_cost, relation_byte_size(), seq_page_cost, and tuplesort_merge_order().
Referenced by cost_incremental_sort(), and cost_sort().
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().
Definition at line 850 of file costsize.c.
References is_redundant_with_indexclauses(), lappend(), lfirst_node, and NIL.
Referenced by cost_index().
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().
|
static |
Definition at line 6380 of file costsize.c.
References Assert, exprType(), exprTypmod(), get_typavgwidth(), IS_SPECIAL_VARNO, IsA, RelOptInfo::max_attr, RelOptInfo::min_attr, root, Var::varattno, Var::varlevelsup, and Var::varno.
Referenced by cost_memoize_rescan(), and set_pathtarget_cost_width().
|
static |
Definition at line 5627 of file costsize.c.