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)
102#define ReleaseVariableStats(vardata) \
104 if (HeapTupleIsValid((vardata).statsTuple)) \
105 (vardata).freefunc((vardata).statsTuple); \
131 double indexCorrelation;
134 double numIndexPages;
135 double numIndexTuples;
136 double spc_random_page_cost;
165 bool *join_is_reversed);
170 Datum constval,
bool varonleft,
174 Datum constval,
bool varonleft,
175 int min_hist_size,
int n_skip,
178 Oid oproid,
Oid collation,
180 double default_selectivity);
184 bool isgt,
bool iseq,
188 Oid oproid,
Oid collation,
189 Datum constval,
bool constisnull,
190 bool varonleft,
bool negate);
192 Oid oproid,
Oid collation,
194 bool varonleft,
bool negate);
213 Oid opfamily,
int strategy,
bool nulls_first,
218 double input_rows,
List **pgset,
226 Node *hashkey,
double nbuckets,
246 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)
List * add_predicate_to_index_quals(IndexOptInfo *index, List *indexQuals)
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)
List * estimate_multivariate_bucketsize(PlannerInfo *root, RelOptInfo *inner, List *hashclauses, Selectivity *innerbucketsize)
bool(* get_index_stats_hook_type)(PlannerInfo *root, Oid indexOid, AttrNumber indexattnum, VariableStatData *vardata)
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)