|
PostgreSQL Source Code git master
|


Go to the source code of this file.
Data Structures | |
| struct | EstimationInfo |
| struct | VariableStatData |
| struct | GenericCosts |
Macros | |
| #define | DEFAULT_EQ_SEL 0.005 |
| #define | DEFAULT_INEQ_SEL 0.3333333333333333 |
| #define | DEFAULT_RANGE_INEQ_SEL 0.005 |
| #define | DEFAULT_MULTIRANGE_INEQ_SEL 0.005 |
| #define | DEFAULT_MATCH_SEL 0.005 |
| #define | DEFAULT_MATCHING_SEL 0.010 |
| #define | DEFAULT_NUM_DISTINCT 200 |
| #define | DEFAULT_UNK_SEL 0.005 |
| #define | DEFAULT_NOT_UNK_SEL (1.0 - DEFAULT_UNK_SEL) |
| #define | CLAMP_PROBABILITY(p) |
| #define | SELFLAG_USED_DEFAULT |
| #define | ReleaseVariableStats(vardata) |
Variables | |
| PGDLLIMPORT get_relation_stats_hook_type | get_relation_stats_hook |
| PGDLLIMPORT get_index_stats_hook_type | get_index_stats_hook |
| #define CLAMP_PROBABILITY | ( | p | ) |
Definition at line 63 of file selfuncs.h.
| #define DEFAULT_EQ_SEL 0.005 |
Definition at line 34 of file selfuncs.h.
| #define DEFAULT_INEQ_SEL 0.3333333333333333 |
Definition at line 37 of file selfuncs.h.
| #define DEFAULT_MATCH_SEL 0.005 |
Definition at line 46 of file selfuncs.h.
| #define DEFAULT_MATCHING_SEL 0.010 |
Definition at line 49 of file selfuncs.h.
| #define DEFAULT_MULTIRANGE_INEQ_SEL 0.005 |
Definition at line 43 of file selfuncs.h.
| #define DEFAULT_NOT_UNK_SEL (1.0 - DEFAULT_UNK_SEL) |
Definition at line 56 of file selfuncs.h.
| #define DEFAULT_NUM_DISTINCT 200 |
Definition at line 52 of file selfuncs.h.
| #define DEFAULT_RANGE_INEQ_SEL 0.005 |
Definition at line 40 of file selfuncs.h.
| #define DEFAULT_UNK_SEL 0.005 |
Definition at line 55 of file selfuncs.h.
| #define SELFLAG_USED_DEFAULT |
Definition at line 76 of file selfuncs.h.
| typedef bool(* get_index_stats_hook_type) (PlannerInfo *root, Oid indexOid, AttrNumber indexattnum, VariableStatData *vardata) |
Definition at line 145 of file selfuncs.h.
| typedef bool(* get_relation_stats_hook_type) (PlannerInfo *root, RangeTblEntry *rte, AttrNumber attnum, VariableStatData *vardata) |
Definition at line 140 of file selfuncs.h.
|
extern |
Definition at line 7618 of file selfuncs.c.
References fb(), lfirst, list_concat(), list_make1, NIL, and predicate_implied_by().
Referenced by btcostestimate(), genericcostestimate(), and gincostestimate().
|
extern |
Definition at line 6304 of file selfuncs.c.
References ACL_SELECT, ACLCHECK_OK, ACLMASK_ALL, Assert, bms_add_member(), bms_next_member(), fb(), find_base_rel_noerr(), FirstLowInvalidHeapAttributeNumber, getRTEPermissionInfo(), GetUserId(), InvalidAttrNumber, NIL, OidIsValid, pg_attribute_aclcheck(), pg_attribute_aclcheck_all(), pg_class_aclcheck(), planner_rt_fetch, root, RTE_RELATION, and RelOptInfo::userid.
Referenced by examine_simple_variable(), examine_variable(), and statext_is_compatible_clause().
|
extern |
Definition at line 1624 of file selfuncs.c.
References arg, ATTSTATSSLOT_NUMBERS, ATTSTATSSLOT_VALUES, CLAMP_PROBABILITY, clause_selectivity(), DatumGetBool(), DEFAULT_NOT_UNK_SEL, DEFAULT_UNK_SEL, elog, ERROR, examine_variable(), fb(), free_attstatsslot(), get_attstatsslot(), GETSTRUCT(), HeapTupleIsValid, InvalidOid, IS_FALSE, IS_NOT_FALSE, IS_NOT_TRUE, IS_NOT_UNKNOWN, IS_TRUE, IS_UNKNOWN, AttStatsSlot::numbers, ReleaseVariableStats, and root.
Referenced by clause_selectivity_ext().
|
extern |
Definition at line 1585 of file selfuncs.c.
References arg, BoolGetDatum(), examine_variable(), fb(), HeapTupleIsValid, InvalidOid, is_funcclause(), ReleaseVariableStats, root, and var_eq_const().
Referenced by clause_selectivity_ext().
|
extern |
Definition at line 2223 of file selfuncs.c.
References ARR_DIMS, ARR_NDIM, ArrayGetNItems(), ATTSTATSSLOT_NUMBERS, clamp_row_est(), DatumGetArrayTypeP, examine_variable(), fb(), free_attstatsslot(), get_attstatsslot(), HeapTupleIsValid, InvalidOid, IsA, list_length(), ReleaseVariableStats, root, and strip_array_coercion().
Referenced by array_unnest_support(), btcostestimate(), cost_qual_eval_walker(), cost_tidscan(), genericcostestimate(), and gincost_scalararrayopexpr().
|
extern |
Definition at line 4390 of file selfuncs.c.
References ATTSTATSSLOT_NUMBERS, clamp_row_est(), examine_variable(), fb(), free_attstatsslot(), get_attstatsslot(), get_variable_numdistinct(), GETSTRUCT(), HeapTupleIsValid, InvalidOid, Max, ReleaseVariableStats, and root.
Referenced by final_cost_hashjoin().
|
extern |
Definition at line 4521 of file selfuncs.c.
References fb(), hash_agg_entry_size(), list_length(), and root.
Referenced by consider_groupingsets_paths().
|
extern |
Definition at line 4123 of file selfuncs.c.
References Assert, bms_get_singleton_member(), RestrictInfo::clause, equal(), estimate_multivariate_ndistinct(), fb(), forboth, foreach_delete_current, get_leftop(), get_rightop(), lappend(), lfirst, lfirst_node, list_concat(), list_copy(), list_free(), list_free_deep(), list_length(), list_member_ptr(), NIL, palloc0_object, remove_nulling_relids(), and root.
Referenced by final_cost_hashjoin().
|
extern |
Definition at line 3771 of file selfuncs.c.
References add_unique_group_var(), Assert, clamp_row_est(), contain_volatile_functions(), estimate_multivariate_ndistinct(), examine_variable(), expression_returns_set_rows(), exprType(), fb(), for_each_from, HeapTupleIsValid, i, IS_SIMPLE_REL, lappend(), lfirst, linitial, list_member_int(), GroupVarInfo::ndistinct, NIL, pull_var_clause(), PVC_RECURSE_AGGREGATES, PVC_RECURSE_PLACEHOLDERS, PVC_RECURSE_WINDOWFUNCS, ReleaseVariableStats, root, RelOptInfo::rows, SELFLAG_USED_DEFAULT, and RelOptInfo::tuples.
Referenced by adjust_rowcount_for_semijoins(), build_setop_child_paths(), cost_incremental_sort(), cost_memoize_rescan(), create_final_distinct_paths(), create_final_unique_paths(), create_partial_distinct_paths(), create_partial_unique_paths(), create_rel_agg_info(), estimate_path_cost_size(), generate_grouped_paths(), generate_union_paths(), get_number_of_groups(), and get_windowclause_startup_tuples().
|
extern |
Definition at line 5636 of file selfuncs.c.
References all_rows_selectable(), arg, Assert, bms_difference(), bms_free(), bms_get_singleton_member(), bms_is_empty, bms_is_member(), bms_overlap(), BoolGetDatum(), elog, equal(), ERROR, examine_simple_variable(), StatisticExtInfo::exprs, exprType(), exprTypmod(), fb(), find_base_rel(), find_join_rel(), get_index_stats_hook, has_unique_index(), HeapTupleIsValid, StatisticExtInfo::inherit, Int16GetDatum(), IsA, StatisticExtInfo::kind, lfirst, list_head(), lnext(), MemSet, NIL, ObjectIdGetDatum(), planner_rt_fetch, pull_varnos(), ReleaseDummy(), ReleaseSysCache(), remove_nulling_relids(), root, SearchSysCache3(), statext_expressions_load(), StatisticExtInfo::statOid, strip_all_phvs_deep(), Var::varattno, and Var::varno.
Referenced by booltestsel(), boolvarsel(), estimate_array_length(), estimate_hash_bucket_stats(), estimate_num_groups(), get_join_variables(), get_restriction_variable(), mergejoinscansel(), nulltestsel(), and scalararraysel_containment().
|
extern |
Definition at line 987 of file selfuncs.c.
References CLAMP_PROBABILITY, fb(), fmgr_info(), get_opcode(), get_restriction_variable(), GETSTRUCT(), HeapTupleIsValid, histogram_selectivity(), IsA, mcv_selectivity(), ReleaseVariableStats, and root.
Referenced by ltreeparentsel(), and matchingsel().
|
extern |
Definition at line 7395 of file selfuncs.c.
References add_predicate_to_index_quals(), ScalarArrayOpExpr::args, RestrictInfo::clause, clauselist_selectivity(), cpu_index_tuple_cost, cpu_operator_cost, estimate_array_length(), fb(), get_quals_from_indexclauses(), get_tablespace_page_costs(), index_other_operands_eval_cost(), index_pages_fetched(), IndexPath::indexclauses, GenericCosts::indexCorrelation, IndexPath::indexinfo, IndexPath::indexorderbys, GenericCosts::indexSelectivity, GenericCosts::indexStartupCost, GenericCosts::indexTotalCost, IsA, JOIN_INNER, lfirst, list_length(), lsecond, GenericCosts::num_sa_scans, GenericCosts::numIndexPages, GenericCosts::numIndexTuples, root, and GenericCosts::spc_random_page_cost.
Referenced by blcostestimate(), btcostestimate(), gistcostestimate(), hashcostestimate(), and spgcostestimate().
|
extern |
Definition at line 5567 of file selfuncs.c.
References bms_is_subset(), elog, ERROR, examine_variable(), fb(), linitial, list_length(), lsecond, root, SpecialJoinInfo::syn_lefthand, and SpecialJoinInfo::syn_righthand.
Referenced by eqjoinsel(), neqjoinsel(), and networkjoinsel().
Definition at line 7311 of file selfuncs.c.
References fb(), lappend(), lfirst_node, and NIL.
Referenced by brincostestimate(), genericcostestimate(), and gincostestimate().
|
extern |
Definition at line 5507 of file selfuncs.c.
References estimate_expression_value(), examine_variable(), fb(), linitial, list_length(), lsecond, ReleaseVariableStats, and root.
Referenced by _int_matchsel(), arraycontsel(), eqsel_internal(), generic_restriction_selectivity(), multirangesel(), networksel(), patternsel_common(), rangesel(), scalarineqsel_wrapper(), and tsmatchsel().
|
extern |
Definition at line 6602 of file selfuncs.c.
References clamp_row_est(), DEFAULT_NUM_DISTINCT, fb(), GETSTRUCT(), HeapTupleIsValid, IsA, RTE_VALUES, SelfItemPointerAttributeNumber, and TableOidAttributeNumber.
Referenced by add_unique_group_var(), btcostestimate(), eqjoinsel(), estimate_hash_bucket_stats(), ineq_histogram_selectivity(), var_eq_const(), and var_eq_non_const().
|
extern |
Definition at line 896 of file selfuncs.c.
References Assert, ATTSTATSSLOT_VALUES, DatumGetBool(), fb(), free_attstatsslot(), FunctionCallInvoke, get_attstatsslot(), HeapTupleIsValid, i, InitFunctionCallInfoData, InvalidOid, LOCAL_FCINFO, and statistic_proc_security_check().
Referenced by generic_restriction_selectivity(), and patternsel_common().
|
extern |
Definition at line 7341 of file selfuncs.c.
References OpExpr::args, ScalarArrayOpExpr::args, cost_qual_eval_node(), elog, ERROR, fb(), IsA, lfirst, lsecond, nodeTag, RowCompareExpr::rargs, and root.
Referenced by brincostestimate(), genericcostestimate(), and gincostestimate().
|
extern |
Definition at line 1114 of file selfuncs.c.
References ATTSTATSSLOT_NUMBERS, ATTSTATSSLOT_VALUES, CLAMP_PROBABILITY, comparison_ops_are_compatible(), convert_to_scalar(), DatumGetBool(), fb(), free_attstatsslot(), FunctionCall2Coll(), FunctionCallInvoke, get_actual_variable_range(), get_attstatsslot(), get_variable_numdistinct(), HeapTupleIsValid, i, InitFunctionCallInfoData, InvalidOid, LOCAL_FCINFO, AttStatsSlot::nvalues, root, statistic_proc_security_check(), and val.
Referenced by prefix_selectivity(), and scalarineqsel().
|
extern |
Definition at line 805 of file selfuncs.c.
References ATTSTATSSLOT_NUMBERS, ATTSTATSSLOT_VALUES, DatumGetBool(), fb(), free_attstatsslot(), FunctionCallInvoke, get_attstatsslot(), HeapTupleIsValid, i, InitFunctionCallInfoData, InvalidOid, LOCAL_FCINFO, and statistic_proc_security_check().
Referenced by generic_restriction_selectivity(), networksel(), patternsel_common(), and scalarineqsel().
|
extern |
Definition at line 3285 of file selfuncs.c.
References Assert, CLAMP_PROBABILITY, COMPARE_EQ, COMPARE_GE, COMPARE_GT, COMPARE_LE, COMPARE_LT, DEFAULT_INEQ_SEL, examine_variable(), fb(), get_leftop(), get_op_opfamily_properties(), get_opfamily_member(), get_opfamily_method(), get_rightop(), get_variable_range(), GETSTRUCT(), HeapTupleIsValid, IndexAmTranslateCompareType(), IndexAmTranslateStrategy(), is_opclause(), OidIsValid, ReleaseVariableStats, root, and scalarineqsel().
Referenced by cached_scansel().
|
extern |
Definition at line 1782 of file selfuncs.c.
References arg, CLAMP_PROBABILITY, DEFAULT_NOT_UNK_SEL, DEFAULT_UNK_SEL, elog, ERROR, examine_variable(), fb(), GETSTRUCT(), HeapTupleIsValid, IS_NOT_NULL, IS_NULL, IsA, ReleaseVariableStats, and root.
Referenced by clause_selectivity_ext(), and clauselist_selectivity_ext().
|
extern |
Definition at line 2289 of file selfuncs.c.
References fb(), join_selectivity(), RowCompareExpr::largs, linitial, linitial_oid, list_make2, NumRelids(), RowCompareExpr::rargs, restriction_selectivity(), root, and s1.
Referenced by clause_selectivity_ext().
|
extern |
Definition at line 1900 of file selfuncs.c.
References ScalarArrayOpExpr::args, ARR_ELEMTYPE, Assert, CLAMP_PROBABILITY, DatumGetArrayTypeP, DatumGetFloat8(), deconstruct_array(), TypeCacheEntry::eq_opr, estimate_expression_value(), exprCollation(), exprType(), fb(), fmgr_info(), FunctionCall4Coll(), FunctionCall5Coll(), get_base_element_type(), get_negator(), get_oprjoin(), get_oprrest(), get_typlenbyval(), get_typlenbyvalalign(), i, Int16GetDatum(), Int32GetDatum(), IsA, lfirst, linitial, list_length(), list_make2, lookup_type_cache(), lsecond, makeConst(), makeNode, ObjectIdGetDatum(), OidIsValid, ScalarArrayOpExpr::opno, PointerGetDatum(), root, s1, s2, scalararraysel_containment(), strip_array_coercion(), TYPECACHE_EQ_OPR, and ScalarArrayOpExpr::useOr.
Referenced by clause_selectivity_ext().
|
extern |
Definition at line 81 of file array_selfuncs.c.
References ATTSTATSSLOT_NUMBERS, ATTSTATSSLOT_VALUES, CLAMP_PROBABILITY, TypeCacheEntry::cmp_proc_finfo, examine_variable(), fb(), FmgrInfo::fn_oid, free_attstatsslot(), get_attstatsslot(), GETSTRUCT(), HeapTupleIsValid, InvalidOid, IsA, lookup_type_cache(), mcelem_array_contain_overlap_selec(), mcelem_array_contained_selec(), OidIsValid, ReleaseVariableStats, root, statistic_proc_security_check(), and TYPECACHE_CMP_PROC_FINFO.
Referenced by scalararraysel().
|
extern |
Definition at line 6573 of file selfuncs.c.
References DEBUG2, ereport, errmsg_internal(), fb(), get_func_leakproof(), get_func_name(), and OidIsValid.
Referenced by calc_arraycontsel(), calc_hist_selectivity(), calc_hist_selectivity(), eqjoinsel(), get_variable_range(), histogram_selectivity(), ineq_histogram_selectivity(), mcv_selectivity(), scalararraysel_containment(), and var_eq_const().
|
extern |
Definition at line 368 of file selfuncs.c.
References ATTSTATSSLOT_NUMBERS, ATTSTATSSLOT_VALUES, CLAMP_PROBABILITY, DatumGetBool(), fb(), fmgr_info(), free_attstatsslot(), FunctionCallInvoke, get_attstatsslot(), get_opcode(), get_variable_numdistinct(), GETSTRUCT(), HeapTupleIsValid, i, InitFunctionCallInfoData, InvalidOid, LOCAL_FCINFO, and statistic_proc_security_check().
Referenced by boolvarsel(), eqsel_internal(), patternsel_common(), and prefix_selectivity().
|
extern |
Definition at line 539 of file selfuncs.c.
References ATTSTATSSLOT_NUMBERS, CLAMP_PROBABILITY, fb(), free_attstatsslot(), get_attstatsslot(), get_variable_numdistinct(), GETSTRUCT(), HeapTupleIsValid, and InvalidOid.
Referenced by eqsel_internal().
|
extern |
Definition at line 184 of file selfuncs.c.
Referenced by brincostestimate(), examine_indexcol_variable(), and examine_variable().
|
extern |
Definition at line 183 of file selfuncs.c.
Referenced by brincostestimate(), examine_indexcol_variable(), and examine_simple_variable().