25 #include "utils/fmgroids.h" 52 bool use_extended_stats);
109 jointype, sjinfo,
true);
124 bool use_extended_stats)
139 varRelid, jointype, sjinfo,
156 jointype, sjinfo, rel,
157 &estimatedclauses,
false);
216 bool varonleft =
true;
248 varonleft,
true, s2);
253 varonleft,
false, s2);
271 while (rqlist != NULL)
296 varRelid, jointype, sjinfo);
338 rqnext = rqlist->
next;
366 bool use_extended_stats)
388 jointype, sjinfo, rel,
389 &estimatedclauses,
true);
415 jointype, sjinfo, use_extended_stats);
417 s1 = s1 + s2 - s1 *
s2;
439 is_lobound = !isLTsel;
444 is_lobound = isLTsel;
447 for (rqelem = *rqlist; rqelem; rqelem = rqelem->
next)
514 rqelem->
next = *rqlist;
556 lastrelid = rel->
relid;
557 else if (rel->
relid != lastrelid)
572 else if (relid != lastrelid)
623 else if (sjinfo == NULL)
697 jointype, sjinfo,
true);
712 bool use_extended_stats)
716 bool cacheable =
false;
793 (varRelid == 0 || varRelid == (
int) var->
varno))
929 ((
NullTest *) clause)->nulltesttype,
995 #ifdef SELECTIVITY_DEBUG 996 elog(
DEBUG4,
"clause_selectivity: s1 %f", s1);
#define IsA(nodeptr, _type_)
bool is_pseudo_constant_clause_relids(Node *clause, Relids relids)
bool equal(const void *a, const void *b)
Node * estimate_expression_value(PlannerInfo *root, Node *node)
static bool is_orclause(const void *clause)
Selectivity restriction_selectivity(PlannerInfo *root, Oid operatorid, List *args, Oid inputcollid, int varRelid)
Selectivity rowcomparesel(PlannerInfo *root, RowCompareExpr *clause, int varRelid, JoinType jointype, SpecialJoinInfo *sjinfo)
static bool is_andclause(const void *clause)
bool bms_get_singleton_member(const Bitmapset *a, int *member)
Selectivity statext_clauselist_selectivity(PlannerInfo *root, List *clauses, int varRelid, JoinType jointype, SpecialJoinInfo *sjinfo, RelOptInfo *rel, Bitmapset **estimatedclauses, bool is_or)
Selectivity scalararraysel(PlannerInfo *root, ScalarArrayOpExpr *clause, bool is_join_clause, int varRelid, JoinType jointype, SpecialJoinInfo *sjinfo)
static bool is_funcclause(const void *clause)
static bool bms_is_subset_singleton(const Bitmapset *s, int x)
void pfree(void *pointer)
Selectivity nulltestsel(PlannerInfo *root, NullTestType nulltesttype, Node *arg, int varRelid, JoinType jointype, SpecialJoinInfo *sjinfo)
Selectivity function_selectivity(PlannerInfo *root, Oid funcid, List *args, Oid inputcollid, bool is_join, int varRelid, JoinType jointype, SpecialJoinInfo *sjinfo)
Selectivity clause_selectivity(PlannerInfo *root, Node *clause, int varRelid, JoinType jointype, SpecialJoinInfo *sjinfo)
bool is_pseudo_constant_clause(Node *clause)
static Node * get_leftop(const void *clause)
struct RangeQueryClause * next
static void addRangeClause(RangeQueryClause **rqlist, Node *clause, bool varonleft, bool isLTsel, Selectivity s2)
int NumRelids(PlannerInfo *root, Node *clause)
bool bms_is_empty(const Bitmapset *a)
static bool is_notclause(const void *clause)
RegProcedure get_oprrest(Oid opno)
static bool treat_as_join_clause(PlannerInfo *root, Node *clause, RestrictInfo *rinfo, int varRelid, SpecialJoinInfo *sjinfo)
BMS_Membership bms_membership(const Bitmapset *a)
static Node * get_rightop(const void *clause)
static RelOptInfo * find_single_rel_for_clauses(PlannerInfo *root, List *clauses)
static Selectivity clauselist_selectivity_or(PlannerInfo *root, List *clauses, int varRelid, JoinType jointype, SpecialJoinInfo *sjinfo, bool use_extended_stats)
static Expr * get_notclausearg(const void *notclause)
Selectivity clause_selectivity_ext(PlannerInfo *root, Node *clause, int varRelid, JoinType jointype, SpecialJoinInfo *sjinfo, bool use_extended_stats)
struct RangeQueryClause RangeQueryClause
static int list_length(const List *l)
Selectivity clauselist_selectivity_ext(PlannerInfo *root, List *clauses, int varRelid, JoinType jointype, SpecialJoinInfo *sjinfo, bool use_extended_stats)
#define DEFAULT_RANGE_INEQ_SEL
Selectivity join_selectivity(PlannerInfo *root, Oid operatorid, List *args, Oid inputcollid, JoinType jointype, SpecialJoinInfo *sjinfo)
static bool is_opclause(const void *clause)
Selectivity clauselist_selectivity(PlannerInfo *root, List *clauses, int varRelid, JoinType jointype, SpecialJoinInfo *sjinfo)
RelOptInfo * find_base_rel(PlannerInfo *root, int relid)
Selectivity booltestsel(PlannerInfo *root, BoolTestType booltesttype, Node *arg, int varRelid, JoinType jointype, SpecialJoinInfo *sjinfo)
Selectivity boolvarsel(PlannerInfo *root, Node *arg, int varRelid)
bool bms_is_member(int x, const Bitmapset *a)