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(), system_time_samplescangetsamplesize(), and table_block_relation_estimate_size().
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 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 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 cost_qual_eval_walker(), lfirst, QualCost::per_tuple, cost_qual_eval_context::root, root, QualCost::startup, and cost_qual_eval_context::total.
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 cost_qual_eval_walker(), QualCost::per_tuple, cost_qual_eval_context::root, root, QualCost::startup, and cost_qual_eval_context::total.
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, cost_qual_eval_node(), cost_qual_eval_walker(), 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(), cost_qual_eval_node(), and cost_qual_eval_walker().
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(), 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.
References bms_is_member(), bms_membership(), BMS_SINGLETON, CLAMP_PROBABILITY, clause_selectivity(), ForeignKeyOptInfo::con_relid, EquivalenceClass::ec_has_const, ForeignKeyOptInfo::eclass, find_base_rel(), find_derived_clause_for_ec_member(), ForeignKeyOptInfo::fk_eclass_member, foreach_delete_current, i, JOIN_ANTI, JOIN_SEMI, SpecialJoinInfo::jointype, lappend(), lfirst, list_concat(), list_copy(), list_length(), list_member_ptr(), Max, ForeignKeyOptInfo::nconst_ec, NIL, ForeignKeyOptInfo::nkeys, ForeignKeyOptInfo::nmatched_ec, ForeignKeyOptInfo::nmatched_ri, ForeignKeyOptInfo::ref_relid, ForeignKeyOptInfo::rinfos, root, RelOptInfo::rows, and RelOptInfo::tuples.
Referenced by calc_joinrel_size_estimate().
|
static |
Definition at line 973 of file costsize.c.
References BitmapAndPath::bitmapquals, BitmapOrPath::bitmapquals, elog, ERROR, get_indexpath_pages(), IndexPath::indexinfo, IsA, lfirst, nodeTag, and IndexOptInfo::pages.
Referenced by compute_bitmap_pages(), and get_indexpath_pages().
|
static |
Definition at line 6449 of file costsize.c.
References parallel_leader_participation, and Path::parallel_workers.
Referenced by compute_gather_rows(), cost_append(), cost_bitmap_heap_scan(), cost_index(), cost_seqscan(), final_cost_hashjoin(), final_cost_mergejoin(), final_cost_nestloop(), and initial_cost_hashjoin().
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().
|
static |
Definition at line 5048 of file costsize.c.
References RelOptInfo::baserestrictcost, cost_qual_eval(), QualCost::per_tuple, ParamPathInfo::ppi_clauses, root, and QualCost::startup.
Referenced by cost_bitmap_heap_scan(), cost_ctescan(), cost_functionscan(), cost_namedtuplestorescan(), cost_resultscan(), cost_samplescan(), cost_seqscan(), cost_subqueryscan(), cost_tablefuncscan(), cost_tidrangescan(), cost_tidscan(), and cost_valuesscan().
|
static |
Definition at line 2885 of file costsize.c.
References Assert, clamp_row_est(), Const::consttype, DatumGetInt16(), DatumGetInt32(), DatumGetInt64(), DEFAULT_INEQ_SEL, WindowClause::endOffset, estimate_num_groups(), FRAMEOPTION_END_CURRENT_ROW, FRAMEOPTION_END_OFFSET_FOLLOWING, FRAMEOPTION_END_OFFSET_PRECEDING, FRAMEOPTION_END_UNBOUNDED_FOLLOWING, FRAMEOPTION_GROUPS, FRAMEOPTION_RANGE, FRAMEOPTION_ROWS, WindowClause::frameOptions, get_sortgrouplist_exprs(), if(), IsA, list_free(), Min, NIL, WindowClause::orderClause, WindowClause::partitionClause, and root.
Referenced by cost_windowagg().
|
static |
Definition at line 5187 of file costsize.c.
References JoinPath::innerjoinpath, is_redundant_with_indexclauses(), IsA, join_clause_is_movable_into(), JoinPath::joinrestrictinfo, NestPath::jpath, lfirst, NIL, and Path::pathtype.
Referenced by final_cost_nestloop().
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().
|
static |
Definition at line 6439 of file costsize.c.
References relation_byte_size().
Referenced by initial_cost_hashjoin().
|
static |
Definition at line 6428 of file costsize.c.
References MAXALIGN, and SizeofHeapTupleHeader.
Referenced by cost_agg(), cost_material(), cost_memoize_rescan(), cost_rescan(), cost_tuplesort(), final_cost_hashjoin(), final_cost_mergejoin(), and page_size().
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().
|
static |
Definition at line 6185 of file costsize.c.
References Assert, clamp_width_est(), PathTarget::cost, cost_qual_eval_node(), PathTarget::exprs, exprType(), exprTypmod(), find_placeholder_info(), get_attavgwidth(), get_relation_data_width(), get_typavgwidth(), i, InvalidOid, IsA, lfirst, RelOptInfo::max_attr, MAXALIGN, RelOptInfo::min_attr, QualCost::per_tuple, PlaceHolderInfo::ph_width, planner_rt_fetch, RelOptInfo::relid, RelOptInfo::reltarget, root, SizeofHeapTupleHeader, QualCost::startup, Var::varattno, and PathTarget::width.
Referenced by set_baserel_size_estimates(), and set_foreign_size_estimates().
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().
double cpu_index_tuple_cost = DEFAULT_CPU_INDEX_TUPLE_COST |
Definition at line 133 of file costsize.c.
Referenced by genericcostestimate(), and gincostestimate().
double cpu_operator_cost = DEFAULT_CPU_OPERATOR_COST |
Definition at line 134 of file costsize.c.
Referenced by add_function_cost(), brincostestimate(), btcostestimate(), cached_plan_cost(), cost_agg(), cost_bitmap_and_node(), cost_bitmap_or_node(), cost_bitmap_tree_node(), cost_gather_merge(), cost_group(), cost_material(), cost_memoize_rescan(), cost_merge_append(), cost_qual_eval_walker(), cost_rescan(), cost_subplan(), cost_tuplesort(), cost_valuesscan(), cost_windowagg(), create_mergejoin_plan(), create_setop_path(), create_unique_path(), create_upper_unique_path(), estimate_path_cost_size(), final_cost_mergejoin(), find_simplified_clause(), genericcostestimate(), gincostestimate(), gistcostestimate(), initial_cost_hashjoin(), inline_function(), make_sort_input_target(), order_qual_clauses(), spgcostestimate(), and test_support_func().
double cpu_tuple_cost = DEFAULT_CPU_TUPLE_COST |
Definition at line 132 of file costsize.c.
Referenced by cost_agg(), cost_append(), cost_bitmap_heap_scan(), cost_ctescan(), cost_functionscan(), cost_incremental_sort(), cost_index(), cost_memoize_rescan(), cost_merge_append(), cost_namedtuplestorescan(), cost_recursive_union(), cost_rescan(), cost_resultscan(), cost_samplescan(), cost_seqscan(), cost_subqueryscan(), cost_tablefuncscan(), cost_tidrangescan(), cost_tidscan(), cost_valuesscan(), cost_windowagg(), create_group_result_path(), create_lockrows_path(), create_memoize_path(), create_minmaxagg_path(), create_projection_path(), create_set_projection_path(), estimate_costs(), estimate_path_cost_size(), final_cost_hashjoin(), final_cost_mergejoin(), final_cost_nestloop(), and initial_cost_hashjoin().
Cost disable_cost = 1.0e10 |
Definition at line 141 of file costsize.c.
Referenced by final_cost_hashjoin().
int effective_cache_size = DEFAULT_EFFECTIVE_CACHE_SIZE |
Definition at line 139 of file costsize.c.
Referenced by gistBuildCallback(), gistInitBuffering(), and index_pages_fetched().
bool enable_async_append = true |
Definition at line 165 of file costsize.c.
Referenced by create_append_plan().
bool enable_bitmapscan = true |
Definition at line 148 of file costsize.c.
Referenced by cost_bitmap_heap_scan().
bool enable_gathermerge = true |
Definition at line 158 of file costsize.c.
Referenced by cost_gather_merge().
bool enable_hashagg = true |
Definition at line 152 of file costsize.c.
Referenced by compute_semijoin_info(), cost_agg(), create_final_distinct_paths(), create_partial_distinct_paths(), and create_setop_path().
bool enable_hashjoin = true |
Definition at line 157 of file costsize.c.
Referenced by add_paths_to_joinrel(), and initial_cost_hashjoin().
bool enable_incremental_sort = true |
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().
bool enable_indexonlyscan = true |
Definition at line 147 of file costsize.c.
Referenced by check_index_only().
bool enable_indexscan = true |
Definition at line 146 of file costsize.c.
Referenced by cost_index(), and plan_cluster_use_sort().
bool enable_material = true |
Definition at line 154 of file costsize.c.
Referenced by build_subplan(), consider_parallel_nestloop(), cost_material(), final_cost_mergejoin(), and match_unsorted_outer().
bool enable_memoize = true |
Definition at line 155 of file costsize.c.
Referenced by create_memoize_path(), and get_memoize_path().
bool enable_mergejoin = true |
Definition at line 156 of file costsize.c.
Referenced by add_paths_to_joinrel(), and initial_cost_mergejoin().
bool enable_nestloop = true |
Definition at line 153 of file costsize.c.
Referenced by initial_cost_nestloop().
bool enable_parallel_append = true |
Definition at line 161 of file costsize.c.
Referenced by add_paths_to_append_rel(), and generate_union_paths().
bool enable_parallel_hash = true |
Definition at line 162 of file costsize.c.
Referenced by hash_inner_and_outer().
bool enable_partition_pruning = true |
Definition at line 163 of file costsize.c.
Referenced by create_append_plan(), create_merge_append_plan(), and prune_append_rel_partitions().
bool enable_partitionwise_aggregate = false |
Definition at line 160 of file costsize.c.
Referenced by create_grouping_paths().
bool enable_partitionwise_join = false |
Definition at line 159 of file costsize.c.
Referenced by build_joinrel_partition_info(), and set_append_rel_size().
bool enable_presorted_aggregate = true |
Definition at line 164 of file costsize.c.
Referenced by adjust_group_pathkeys_for_groupagg().
bool enable_seqscan = true |
Definition at line 145 of file costsize.c.
Referenced by cost_seqscan().
bool enable_sort = true |
Definition at line 150 of file costsize.c.
Referenced by cost_sort(), and make_sort().
bool enable_tidscan = true |
Definition at line 149 of file costsize.c.
Referenced by cost_tidrangescan(), cost_tidscan(), and create_tidscan_paths().
int max_parallel_workers_per_gather = 2 |
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().
double parallel_setup_cost = DEFAULT_PARALLEL_SETUP_COST |
Definition at line 136 of file costsize.c.
Referenced by cost_gather(), cost_gather_merge(), and standard_planner().
double parallel_tuple_cost = DEFAULT_PARALLEL_TUPLE_COST |
Definition at line 135 of file costsize.c.
Referenced by cost_gather(), cost_gather_merge(), and standard_planner().
double random_page_cost = DEFAULT_RANDOM_PAGE_COST |
Definition at line 131 of file costsize.c.
Referenced by cost_agg(), cost_tuplesort(), get_tablespace_page_costs(), and tablespace_reloptions().
double recursive_worktable_factor = DEFAULT_RECURSIVE_WORKTABLE_FACTOR |
Definition at line 137 of file costsize.c.
Referenced by set_cte_size_estimates().
double seq_page_cost = DEFAULT_SEQ_PAGE_COST |
Definition at line 130 of file costsize.c.
Referenced by cost_agg(), cost_material(), cost_rescan(), cost_tuplesort(), estimate_costs(), estimate_path_cost_size(), get_tablespace_page_costs(), initial_cost_hashjoin(), and tablespace_reloptions().