34 #define DEFAULT_EQ_SEL 0.005
37 #define DEFAULT_INEQ_SEL 0.3333333333333333
40 #define DEFAULT_RANGE_INEQ_SEL 0.005
43 #define DEFAULT_MULTIRANGE_INEQ_SEL 0.005
46 #define DEFAULT_MATCH_SEL 0.005
49 #define DEFAULT_MATCHING_SEL 0.010
52 #define DEFAULT_NUM_DISTINCT 200
55 #define DEFAULT_UNK_SEL 0.005
56 #define DEFAULT_NOT_UNK_SEL (1.0 - DEFAULT_UNK_SEL)
63 #define CLAMP_PROBABILITY(p) \
76 #define SELFLAG_USED_DEFAULT (1 << 0)
101 #define ReleaseVariableStats(vardata) \
103 if (HeapTupleIsValid((vardata).statsTuple)) \
104 (vardata).freefunc((vardata).statsTuple); \
130 double indexCorrelation;
133 double numIndexPages;
134 double numIndexTuples;
135 double spc_random_page_cost;
164 bool *join_is_reversed);
169 Datum constval,
bool varonleft,
173 Datum constval,
bool varonleft,
174 int min_hist_size,
int n_skip,
177 Oid oproid,
Oid collation,
179 double default_selectivity);
183 bool isgt,
bool iseq,
187 Oid oproid,
Oid collation,
188 Datum constval,
bool constisnull,
189 bool varonleft,
bool negate);
191 Oid oproid,
Oid collation,
193 bool varonleft,
bool negate);
212 Oid opfamily,
int strategy,
bool nulls_first,
217 double input_rows,
List **pgset,
221 Node *hashkey,
double nbuckets,
241 Oid elemtype,
bool isEquality,
bool useOr,
Selectivity scalararraysel_containment(PlannerInfo *root, Node *leftop, Node *rightop, Oid elemtype, bool isEquality, bool useOr, int varRelid)
bool get_restriction_variable(PlannerInfo *root, List *args, int varRelid, VariableStatData *vardata, Node **other, bool *varonleft)
List * get_quals_from_indexclauses(List *indexclauses)
double var_eq_const(VariableStatData *vardata, Oid oproid, Oid collation, Datum constval, bool constisnull, bool varonleft, bool negate)
double generic_restriction_selectivity(PlannerInfo *root, Oid oproid, Oid collation, List *args, int varRelid, double default_selectivity)
Selectivity booltestsel(PlannerInfo *root, BoolTestType booltesttype, Node *arg, int varRelid, JoinType jointype, SpecialJoinInfo *sjinfo)
double estimate_array_length(PlannerInfo *root, Node *arrayexpr)
double mcv_selectivity(VariableStatData *vardata, FmgrInfo *opproc, Oid collation, Datum constval, bool varonleft, double *sumcommonp)
Selectivity nulltestsel(PlannerInfo *root, NullTestType nulltesttype, Node *arg, int varRelid, JoinType jointype, SpecialJoinInfo *sjinfo)
PGDLLIMPORT get_relation_stats_hook_type get_relation_stats_hook
struct VariableStatData VariableStatData
void examine_variable(PlannerInfo *root, Node *node, int varRelid, VariableStatData *vardata)
void mergejoinscansel(PlannerInfo *root, Node *clause, Oid opfamily, int strategy, bool nulls_first, Selectivity *leftstart, Selectivity *leftend, Selectivity *rightstart, Selectivity *rightend)
bool(* get_relation_stats_hook_type)(PlannerInfo *root, RangeTblEntry *rte, AttrNumber attnum, VariableStatData *vardata)
struct EstimationInfo EstimationInfo
double estimate_num_groups(PlannerInfo *root, List *groupExprs, double input_rows, List **pgset, EstimationInfo *estinfo)
double ineq_histogram_selectivity(PlannerInfo *root, VariableStatData *vardata, Oid opoid, FmgrInfo *opproc, bool isgt, bool iseq, Oid collation, Datum constval, Oid consttype)
void genericcostestimate(PlannerInfo *root, IndexPath *path, double loop_count, GenericCosts *costs)
bool(* get_index_stats_hook_type)(PlannerInfo *root, Oid indexOid, AttrNumber indexattnum, VariableStatData *vardata)
List * add_predicate_to_index_quals(IndexOptInfo *index, List *indexQuals)
double histogram_selectivity(VariableStatData *vardata, FmgrInfo *opproc, Oid collation, Datum constval, bool varonleft, int min_hist_size, int n_skip, int *hist_size)
Selectivity boolvarsel(PlannerInfo *root, Node *arg, int varRelid)
Selectivity scalararraysel(PlannerInfo *root, ScalarArrayOpExpr *clause, bool is_join_clause, int varRelid, JoinType jointype, SpecialJoinInfo *sjinfo)
double var_eq_non_const(VariableStatData *vardata, Oid oproid, Oid collation, Node *other, bool varonleft, bool negate)
double get_variable_numdistinct(VariableStatData *vardata, bool *isdefault)
PGDLLIMPORT get_index_stats_hook_type get_index_stats_hook
bool statistic_proc_security_check(VariableStatData *vardata, Oid func_oid)
double estimate_hashagg_tablesize(PlannerInfo *root, Path *path, const AggClauseCosts *agg_costs, double dNumGroups)
void estimate_hash_bucket_stats(PlannerInfo *root, Node *hashkey, double nbuckets, Selectivity *mcv_freq, Selectivity *bucketsize_frac)
Cost index_other_operands_eval_cost(PlannerInfo *root, List *indexquals)
Selectivity rowcomparesel(PlannerInfo *root, RowCompareExpr *clause, int varRelid, JoinType jointype, SpecialJoinInfo *sjinfo)
void get_join_variables(PlannerInfo *root, List *args, SpecialJoinInfo *sjinfo, VariableStatData *vardata1, VariableStatData *vardata2, bool *join_is_reversed)
void(* freefunc)(HeapTuple tuple)