42#define IndexCollMatchesExprColl(idxcollation, exprcollation) \
43 ((idxcollation) == InvalidOid || (idxcollation) == (exprcollation))
84 List **bitindexpaths);
91 List *indexjoinclauses,
92 int considered_clauses,
93 List **considered_relids);
101 List **considered_relids);
103 List *indexjoinclauses);
106 List **bitindexpaths);
109 bool useful_predicate,
111 bool *skip_nonnative_saop);
113 List *clauses,
List *other_clauses);
115 List *clauses,
List *other_clauses);
140 List **joinorclauses);
193 List **orderby_clauses_p,
194 List **clause_columns_p);
196 int indexcol,
Expr *clause,
Oid pk_opfamily);
258 bitindexpaths = bitjoinpaths = joinorclauses =
NIL;
279 MemSet(&rclauseset, 0,
sizeof(rclauseset));
296 MemSet(&jclauseset, 0,
sizeof(jclauseset));
298 &jclauseset, &joinorclauses);
304 MemSet(&eclauseset, 0,
sizeof(eclauseset));
326 bitindexpaths =
list_concat(bitindexpaths, indexpaths);
334 bitjoinpaths =
list_concat(bitjoinpaths, indexpaths);
343 if (bitindexpaths !=
NIL)
368 if (bitjoinpaths !=
NIL)
370 List *all_path_outers;
373 all_path_outers =
NIL;
374 foreach(lc, bitjoinpaths)
384 foreach(lc, all_path_outers)
396 foreach(lcp, bitjoinpaths)
401 this_path_set =
lappend(this_path_set, path);
408 this_path_set =
list_concat(this_path_set, bitindexpaths);
417 required_outer, loop_count, 0);
444 List **bitindexpaths)
446 int considered_clauses = 0;
471 for (indexcol = 0; indexcol <
index->nkeycolumns; indexcol++)
476 rclauseset, jclauseset, eclauseset,
484 rclauseset, jclauseset, eclauseset,
510 List **bitindexpaths,
511 List *indexjoinclauses,
512 int considered_clauses,
513 List **considered_relids)
518 foreach(lc, indexjoinclauses)
521 Relids clause_relids = iclause->
rinfo->clause_relids;
523 int num_considered_relids;
526 if (
list_member(*considered_relids, clause_relids))
542 num_considered_relids =
list_length(*considered_relids);
543 for (
int pos = 0; pos < num_considered_relids; pos++)
574 if (
list_length(*considered_relids) >= 10 * considered_clauses)
579 rclauseset, jclauseset, eclauseset,
587 rclauseset, jclauseset, eclauseset,
613 List **bitindexpaths,
615 List **considered_relids)
625 MemSet(&clauseset, 0,
sizeof(clauseset));
627 for (indexcol = 0; indexcol <
index->nkeycolumns; indexcol++)
677 *considered_relids =
lappend(*considered_relids, relids);
687 List *indexjoinclauses)
691 foreach(lc, indexjoinclauses)
696 if (rinfo->parent_ec == parent_ec &&
720 List **bitindexpaths)
723 bool skip_nonnative_saop =
false;
734 &skip_nonnative_saop);
748 foreach(lc, indexpaths)
752 if (
index->amhasgettuple)
755 if (
index->amhasgetbitmap &&
758 *bitindexpaths =
lappend(*bitindexpaths, ipath);
766 if (skip_nonnative_saop)
773 *bitindexpaths =
list_concat(*bitindexpaths, indexpaths);
814 bool useful_predicate,
816 bool *skip_nonnative_saop)
823 List *orderbyclauses;
824 List *orderbyclausecols;
825 List *index_pathkeys;
826 List *useful_pathkeys;
827 bool pathkeys_possibly_useful;
828 bool index_is_ordered;
829 bool index_only_scan;
840 if (!
index->amhasgettuple)
844 if (!
index->amhasgetbitmap)
866 for (indexcol = 0; indexcol <
index->nkeycolumns; indexcol++)
875 if (skip_nonnative_saop && !
index->amsearcharray &&
885 *skip_nonnative_saop =
true;
890 index_clauses =
lappend(index_clauses, iclause);
892 rinfo->clause_relids);
903 if (index_clauses ==
NIL && !
index->amoptionalkey)
920 index_is_ordered = (
index->sortopfamily != NULL);
921 if (index_is_ordered && pathkeys_possibly_useful)
927 orderbyclauses =
NIL;
928 orderbyclausecols =
NIL;
930 else if (
index->amcanorderbyop && pathkeys_possibly_useful)
942 useful_pathkeys =
root->query_pathkeys;
949 useful_pathkeys =
NIL;
950 orderbyclauses =
NIL;
951 orderbyclausecols =
NIL;
968 if (index_clauses !=
NIL || useful_pathkeys !=
NIL || useful_predicate ||
981 result =
lappend(result, ipath);
987 if (
index->amcanparallel &&
1016 if (index_is_ordered && pathkeys_possibly_useful)
1022 if (useful_pathkeys !=
NIL)
1034 result =
lappend(result, ipath);
1037 if (
index->amcanparallel &&
1095 List *clauses,
List *other_clauses)
1106 bool useful_predicate;
1109 if (!
index->amhasgetbitmap)
1124 useful_predicate =
false;
1134 if (all_clauses ==
NIL)
1141 useful_predicate =
true;
1148 MemSet(&clauseset, 0,
sizeof(clauseset));
1155 if (!clauseset.
nonempty && !useful_predicate)
1219 else if (match_a->
opno > match_b->
opno)
1279 bool matched =
false;
1287 orargs = ((
BoolExpr *) rinfo->orclause)->args;
1327 opno = clause->
opno;
1365 nonConstExpr = rightop;
1371 nonConstExpr = leftop;
1394 if (!
index->amhasgetbitmap || !
index->amsearcharray)
1397 for (colnum = 0; colnum <
index->nkeycolumns; colnum++)
1403 matches[
i].
opno = opno;
1414 if (matches[
i].indexnum >= 0)
1444 for (
i = 1;
i < n;
i++)
1453 if (matches[
i].indexnum == matches[
i - 1].indexnum &&
1454 matches[
i].colnum == matches[
i - 1].colnum &&
1455 matches[
i].opno == matches[
i - 1].opno &&
1456 matches[
i].inputcollid == matches[
i - 1].inputcollid &&
1457 matches[
i].indexnum != -1)
1469 for (
i = 1;
i <= n;
i++)
1472 if (group_start >= 0 &&
1474 matches[
i].indexnum != matches[group_start].indexnum ||
1475 matches[
i].colnum != matches[group_start].colnum ||
1476 matches[
i].opno != matches[group_start].opno ||
1477 matches[
i].inputcollid != matches[group_start].inputcollid ||
1478 matches[
i].indexnum == -1))
1483 if (
i - group_start == 1)
1487 matches[group_start].argindex));
1502 for (
j = group_start;
j <
i;
j++)
1520 rinfo->pseudoconstant,
1525 result =
lappend(result, subrinfo);
1558 Cost jointcost = 0.0,
1583 if (jointlist !=
NIL && other_clauses ==
NIL)
1605 splitlist =
lappend(splitlist, bitmapqual);
1611 if (splitlist ==
NIL)
1613 else if (jointlist ==
NIL)
1616 return (jointcost < splitcost) ? jointlist : splitlist;
1632 List *clauses,
List *other_clauses)
1644 foreach(lc, clauses)
1651 List *inner_other_clauses =
NIL;
1670 if (groupedArgs != ((
BoolExpr *) rinfo->orclause)->args)
1684 foreach(
j, groupedArgs)
1714 inner_other_clauses);
1754 pathlist =
lappend(pathlist, bitmapqual);
1757 if (inner_other_clauses !=
NIL)
1764 if (pathlist !=
NIL)
1767 result =
lappend(result, bitmapqual);
1870 pathinfoarray[npaths++] = pathinfo;
1874 for (
i = 0;
i < npaths;
i++)
1876 if (!pathinfoarray[
i]->unclassifiable &&
1891 pathinfoarray[
i] = pathinfo;
1896 pathinfoarray[npaths++] = pathinfo;
1902 return pathinfoarray[0]->
path;
1917 for (
i = 0;
i < npaths;
i++)
1923 pathinfo = pathinfoarray[
i];
1929 for (
j =
i + 1;
j < npaths;
j++)
1933 pathinfo = pathinfoarray[
j];
1937 if (pathinfo->
preds)
1939 bool redundant =
false;
1942 foreach(l, pathinfo->
preds)
1958 if (newcost < costsofar)
1961 costsofar = newcost;
1975 if (
i == 0 || costsofar < bestcost)
1978 bestcost = costsofar;
2012 if (aselec < bselec)
2014 if (aselec > bselec)
2030 bpath.
path.type = T_BitmapHeapPath;
2032 bpath.
path.parent = rel;
2034 bpath.
path.param_info = ipath->param_info;
2046 bpath.
path.param_info,
2095 result->
path = path;
2119 foreach(lc, result->
quals)
2126 foreach(lc, result->
preds)
2209 foreach(lc, *nodelist)
2213 if (
equal(node, oldnode))
2218 *nodelist =
lappend(*nodelist, node);
2233 Bitmapset *index_canreturn_attrs = NULL;
2264 foreach(lc,
index->indrestrictinfo)
2275 for (
i = 0;
i <
index->ncolumns;
i++)
2277 int attno =
index->indexkeys[
i];
2287 index_canreturn_attrs =
2334 if (outer_relids == NULL)
2339 while ((outer_relid =
bms_next_member(outer_relids, outer_relid)) >= 0)
2345 if (outer_relid >=
root->simple_rel_array_size)
2347 outer_rel =
root->simple_rel_array[outer_relid];
2348 if (outer_rel == NULL)
2366 if (result == 0.0 || result > rowcount)
2370 return (result > 0.0) ? result : 1.0;
2388 foreach(lc,
root->join_info_list)
2406 if (rowcount > nunique)
2427 double rowcount = 1.0;
2436 if (relid >=
root->simple_rel_array_size)
2438 rel =
root->simple_rel_array[relid];
2451 rowcount *= rel->
rows;
2486 List **joinorclauses)
2523 if (!
index->rel->has_eclass_joins)
2526 for (indexcol = 0; indexcol <
index->nkeycolumns; indexcol++)
2533 arg.indexcol = indexcol;
2538 index->rel->lateral_referencers);
2562 foreach(lc, clauses)
2601 if (rinfo->pseudoconstant)
2612 for (indexcol = 0; indexcol <
index->nkeycolumns; indexcol++)
2622 if (iclause->
rinfo == rinfo)
2721 Assert(indexcol < index->nkeycolumns);
2731 opfamily =
index->opfamily[indexcol];
2768 if (!nt->argisrow &&
2772 iclause->
rinfo = rinfo;
2774 iclause->
lossy =
false;
2796 return IsBuiltinBooleanOpfamily(opfamily);
2888 iclause->
rinfo = rinfo;
2890 iclause->
lossy =
false;
2930 expr_op = clause->
opno;
2931 expr_coll = clause->inputcollid;
2933 index_relid =
index->rel->relid;
2934 opfamily =
index->opfamily[indexcol];
2935 idxcollation =
index->indexcollations[indexcol];
2954 iclause->
rinfo = rinfo;
2956 iclause->
lossy =
false;
2993 iclause->
rinfo = rinfo;
2995 iclause->
lossy =
false;
3044 foreach(lc, clause->
args)
3084 req.
type = T_SupportRequestIndexCondition;
3110 foreach(lc, sresult)
3114 indexquals =
lappend(indexquals,
3118 iclause->
rinfo = rinfo;
3157 expr_op = saop->
opno;
3158 expr_coll = saop->inputcollid;
3160 index_relid =
index->rel->relid;
3161 opfamily =
index->opfamily[indexcol];
3162 idxcollation =
index->indexcollations[indexcol];
3176 iclause->
rinfo = rinfo;
3178 iclause->
lossy =
false;
3220 if (
index->relam != BTREE_AM_OID)
3223 index_relid =
index->rel->relid;
3224 opfamily =
index->opfamily[indexcol];
3225 idxcollation =
index->indexcollations[indexcol];
3264 var_on_left =
false;
3305 Node *indexExpr = NULL;
3310 bool firstTime =
true;
3311 bool haveNonConst =
false;
3328 foreach(lc, orclause->
args)
3346 opno = subClause->
opno;
3364 constExpr = rightop;
3376 indexExpr = rightop;
3394 inputcollid = subClause->inputcollid;
3411 if (consttype == RECORDOID ||
exprType(indexExpr) == RECORDOID)
3418 if (matchOpno != opno ||
3419 inputcollid != subClause->inputcollid ||
3429 haveNonConst =
true;
3431 consts =
lappend(consts, constExpr);
3440 if (lc != NULL || indexExpr == NULL)
3455 saopexpr =
make_SAOP_expr(matchOpno, indexExpr, consttype, inputcollid,
3456 inputcollid, consts, haveNonConst);
3457 Assert(saopexpr != NULL);
3463 iclause->rinfo = rinfo;
3465 (
Expr *) saopexpr));
3466 iclause->lossy =
false;
3467 iclause->indexcol = indexcol;
3468 iclause->indexcols =
NIL;
3517 iclause->
rinfo = rinfo;
3522 var_args = clause->
largs;
3523 non_var_args = clause->
rargs;
3527 var_args = clause->
rargs;
3528 non_var_args = clause->
largs;
3575 for (
i = 0;
i <
index->nkeycolumns;
i++)
3579 index->opfamily[
i]) == op_strategy &&
3585 if (
i >=
index->nkeycolumns)
3599 righttypes =
lappend_oid(righttypes, op_righttype);
3612 if (var_on_left && !iclause->
lossy)
3621 if (!iclause->
lossy)
3643 elog(
ERROR,
"unexpected strategy number %d", op_strategy);
3645 forthree(opfamilies_cell, opfamilies,
3646 lefttypes_cell, lefttypes,
3647 righttypes_cell, righttypes)
3656 elog(
ERROR,
"missing operator %d(%u,%u) in opfamily %u",
3657 op_strategy, lefttype, righttype, opfam);
3663 if (matching_cols > 1)
3668 rc->opnos = new_ops;
3719 List **orderby_clauses_p,
3720 List **clause_columns_p)
3724 *orderby_clauses_p =
NIL;
3725 *clause_columns_p =
NIL;
3728 if (!
index->amcanorderbyop)
3731 foreach(lc1, pathkeys)
3744 if (pathkey->pk_eclass->ec_has_volatile)
3756 index->rel->relids);
3773 for (indexcol = 0; indexcol <
index->nkeycolumns; indexcol++)
3783 *orderby_clauses_p =
lappend(*orderby_clauses_p, expr);
3784 *clause_columns_p =
lappend_int(*clause_columns_p, indexcol);
3843 Assert(indexcol < index->nkeycolumns);
3845 opfamily =
index->opfamily[indexcol];
3846 idxcollation =
index->indexcollations[indexcol];
3855 if (!leftop || !rightop)
3857 expr_op = ((
OpExpr *) clause)->opno;
3858 expr_coll = ((
OpExpr *) clause)->inputcollid;
3894 if (sortfamily != pk_opfamily)
3903 memcpy(newclause, clause,
sizeof(
OpExpr));
3906 newclause->
opno = expr_op;
3910 clause = (
Expr *) newclause;
3959 have_partial =
false;
3966 have_partial =
true;
3989 clauselist =
lappend(clauselist, rinfo);
4062 if (!
index->amoptionalkey)
4074 index->indpred,
false))
4100 Assert(indexcol < index->nkeycolumns);
4102 curFamily =
index->opfamily[indexcol];
4103 curCollation =
index->indexcollations[indexcol];
4115 if (
index->relam == BTREE_AM_OID &&
4148 List *restrictlist,
List **extra_clauses)
4169 if (restrictinfo->mergeopfamilies ==
NIL)
4179 restrictinfo->outer_is_left =
true;
4184 restrictinfo->outer_is_left =
false;
4190 restrictlist =
lappend(restrictlist, restrictinfo);
4194 if (restrictlist ==
NIL)
4212 if (!
ind->unique || !
ind->immediate ||
ind->indpred !=
NIL)
4219 for (
c = 0;
c <
ind->nkeycolumns;
c++)
4223 foreach(lc, restrictlist)
4244 if (rinfo->outer_is_left)
4264 exprs =
lappend(exprs, rinfo);
4277 if (
c ==
ind->nkeycolumns)
4280 *extra_clauses = exprs;
4316 foreach(lc,
index->rel->baserestrictinfo)
4325 if (rinfo->pseudoconstant)
4382 indkey =
index->indexkeys[indexcol];
4388 if (operand &&
IsA(operand,
Var) &&
4389 index->rel->relid == ((
Var *) operand)->varno &&
4390 indkey == ((
Var *) operand)->varattno &&
4391 ((
Var *) operand)->varnullingrels == NULL)
4406 for (
i = 0;
i < indexcol;
i++)
4408 if (
index->indexkeys[
i] == 0)
4410 if (indexpr_item == NULL)
4411 elog(
ERROR,
"wrong number of index expressions");
4412 indexpr_item =
lnext(
index->indexprs, indexpr_item);
4415 if (indexpr_item == NULL)
4416 elog(
ERROR,
"wrong number of index expressions");
4425 if (
equal(indexkey, operand))
void create_partial_bitmap_paths(PlannerInfo *root, RelOptInfo *rel, Path *bitmapqual)
Bitmapset * bms_difference(const Bitmapset *a, const Bitmapset *b)
bool bms_equal(const Bitmapset *a, const Bitmapset *b)
BMS_Comparison bms_subset_compare(const Bitmapset *a, const Bitmapset *b)
int bms_next_member(const Bitmapset *a, int prevbit)
Bitmapset * bms_del_members(Bitmapset *a, const Bitmapset *b)
Bitmapset * bms_del_member(Bitmapset *a, int x)
bool bms_is_subset(const Bitmapset *a, const Bitmapset *b)
void bms_free(Bitmapset *a)
bool bms_is_member(int x, const Bitmapset *a)
Bitmapset * bms_add_member(Bitmapset *a, int x)
Bitmapset * bms_add_members(Bitmapset *a, const Bitmapset *b)
Bitmapset * bms_union(const Bitmapset *a, const Bitmapset *b)
BMS_Membership bms_membership(const Bitmapset *a)
bool bms_overlap(const Bitmapset *a, const Bitmapset *b)
Bitmapset * bms_copy(const Bitmapset *a)
#define MemSet(start, val, len)
#define OidIsValid(objectId)
bool contain_mutable_functions(Node *clause)
ScalarArrayOpExpr * make_SAOP_expr(Oid oper, Node *leftexpr, Oid coltype, Oid arraycollid, Oid inputcollid, List *exprs, bool haveNonConst)
bool contain_volatile_functions(Node *clause)
void cost_bitmap_tree_node(Path *path, Cost *cost, Selectivity *selec)
void cost_bitmap_heap_scan(Path *path, PlannerInfo *root, RelOptInfo *baserel, ParamPathInfo *param_info, Path *bitmapqual, double loop_count)
bool enable_indexonlyscan
bool equal(const void *a, const void *b)
void setup_eclass_member_iterator(EquivalenceMemberIterator *it, EquivalenceClass *ec, Relids child_relids)
List * generate_implied_equalities_for_column(PlannerInfo *root, RelOptInfo *rel, ec_matches_callback_type callback, void *callback_arg, Relids prohibited_rels)
EquivalenceMember * eclass_member_iterator_next(EquivalenceMemberIterator *it)
List * generate_join_implied_equalities(PlannerInfo *root, Relids join_relids, Relids outer_relids, RelOptInfo *inner_rel, SpecialJoinInfo *sjinfo)
#define palloc_object(type)
#define palloc_array(type, count)
#define OidFunctionCall1(functionId, arg1)
Assert(PointerIsAligned(start, uint64))
static bool IsBooleanOpfamily(Oid opfamily)
static Path * choose_bitmap_and(PlannerInfo *root, RelOptInfo *rel, List *paths)
static Cost bitmap_and_cost_est(PlannerInfo *root, RelOptInfo *rel, List *paths)
static void find_indexpath_quals(Path *bitmapqual, List **quals, List **preds)
static void get_join_index_paths(PlannerInfo *root, RelOptInfo *rel, IndexOptInfo *index, IndexClauseSet *rclauseset, IndexClauseSet *jclauseset, IndexClauseSet *eclauseset, List **bitindexpaths, Relids relids, List **considered_relids)
static int or_arg_index_match_cmp(const void *a, const void *b)
static void match_clause_to_index(PlannerInfo *root, RestrictInfo *rinfo, IndexOptInfo *index, IndexClauseSet *clauseset)
bool is_pseudo_constant_for_index(PlannerInfo *root, Node *expr, IndexOptInfo *index)
static bool eclass_already_used(EquivalenceClass *parent_ec, Relids oldrelids, List *indexjoinclauses)
static void match_join_clauses_to_index(PlannerInfo *root, RelOptInfo *rel, IndexOptInfo *index, IndexClauseSet *clauseset, List **joinorclauses)
static IndexClause * match_saopclause_to_indexcol(PlannerInfo *root, RestrictInfo *rinfo, int indexcol, IndexOptInfo *index)
static bool check_index_only(RelOptInfo *rel, IndexOptInfo *index)
static void match_eclass_clauses_to_index(PlannerInfo *root, IndexOptInfo *index, IndexClauseSet *clauseset)
static PathClauseUsage * classify_index_clause_usage(Path *path, List **clauselist)
static void get_index_paths(PlannerInfo *root, RelOptInfo *rel, IndexOptInfo *index, IndexClauseSet *clauses, List **bitindexpaths)
Node * strip_phvs_in_index_operand(Node *operand)
void check_index_predicates(PlannerInfo *root, RelOptInfo *rel)
static List * build_index_paths(PlannerInfo *root, RelOptInfo *rel, IndexOptInfo *index, IndexClauseSet *clauses, bool useful_predicate, ScanTypeControl scantype, bool *skip_nonnative_saop)
static void match_pathkeys_to_index(IndexOptInfo *index, List *pathkeys, List **orderby_clauses_p, List **clause_columns_p)
static int find_list_position(Node *node, List **nodelist)
static void match_clauses_to_index(PlannerInfo *root, List *clauses, IndexOptInfo *index, IndexClauseSet *clauseset)
static double get_loop_count(PlannerInfo *root, Index cur_relid, Relids outer_relids)
static void consider_index_join_outer_rels(PlannerInfo *root, RelOptInfo *rel, IndexOptInfo *index, IndexClauseSet *rclauseset, IndexClauseSet *jclauseset, IndexClauseSet *eclauseset, List **bitindexpaths, List *indexjoinclauses, int considered_clauses, List **considered_relids)
void create_index_paths(PlannerInfo *root, RelOptInfo *rel)
static double adjust_rowcount_for_semijoins(PlannerInfo *root, Index cur_relid, Index outer_relid, double rowcount)
static IndexClause * match_clause_to_indexcol(PlannerInfo *root, RestrictInfo *rinfo, int indexcol, IndexOptInfo *index)
static bool ec_member_matches_indexcol(PlannerInfo *root, RelOptInfo *rel, EquivalenceClass *ec, EquivalenceMember *em, void *arg)
static IndexClause * get_index_clause_from_support(PlannerInfo *root, RestrictInfo *rinfo, Oid funcid, int indexarg, int indexcol, IndexOptInfo *index)
#define IndexCollMatchesExprColl(idxcollation, exprcollation)
static IndexClause * match_orclause_to_indexcol(PlannerInfo *root, RestrictInfo *rinfo, int indexcol, IndexOptInfo *index)
static IndexClause * match_opclause_to_indexcol(PlannerInfo *root, RestrictInfo *rinfo, int indexcol, IndexOptInfo *index)
static Cost bitmap_scan_cost_est(PlannerInfo *root, RelOptInfo *rel, Path *ipath)
bool match_index_to_operand(Node *operand, int indexcol, IndexOptInfo *index)
static IndexClause * match_boolean_index_clause(PlannerInfo *root, RestrictInfo *rinfo, int indexcol, IndexOptInfo *index)
static void consider_index_join_clauses(PlannerInfo *root, RelOptInfo *rel, IndexOptInfo *index, IndexClauseSet *rclauseset, IndexClauseSet *jclauseset, IndexClauseSet *eclauseset, List **bitindexpaths)
static int or_arg_index_match_cmp_group(const void *a, const void *b)
static Node * strip_phvs_in_index_operand_mutator(Node *node, void *context)
static IndexClause * expand_indexqual_rowcompare(PlannerInfo *root, RestrictInfo *rinfo, int indexcol, IndexOptInfo *index, Oid expr_op, bool var_on_left)
static void match_restriction_clauses_to_index(PlannerInfo *root, IndexOptInfo *index, IndexClauseSet *clauseset)
static IndexClause * match_rowcompare_to_indexcol(PlannerInfo *root, RestrictInfo *rinfo, int indexcol, IndexOptInfo *index)
static List * build_paths_for_OR(PlannerInfo *root, RelOptInfo *rel, List *clauses, List *other_clauses)
bool indexcol_is_bool_constant_for_query(PlannerInfo *root, IndexOptInfo *index, int indexcol)
static IndexClause * match_funcclause_to_indexcol(PlannerInfo *root, RestrictInfo *rinfo, int indexcol, IndexOptInfo *index)
static int path_usage_comparator(const void *a, const void *b)
static bool contain_strippable_phv_walker(Node *node, void *context)
static List * group_similar_or_args(PlannerInfo *root, RelOptInfo *rel, RestrictInfo *rinfo)
static double approximate_joinrel_size(PlannerInfo *root, Relids relids)
static Expr * match_clause_to_ordering_op(IndexOptInfo *index, int indexcol, Expr *clause, Oid pk_opfamily)
bool relation_has_unique_index_for(PlannerInfo *root, RelOptInfo *rel, List *restrictlist, List **extra_clauses)
static List * generate_bitmap_or_paths(PlannerInfo *root, RelOptInfo *rel, List *clauses, List *other_clauses)
static List * make_bitmap_paths_for_or_group(PlannerInfo *root, RelOptInfo *rel, RestrictInfo *ri, List *other_clauses)
if(TABLE==NULL||TABLE_index==NULL)
List * lappend(List *list, void *datum)
List * list_delete(List *list, void *datum)
List * list_append_unique(List *list, void *datum)
List * list_concat(List *list1, const List *list2)
List * list_concat_copy(const List *list1, const List *list2)
List * list_copy(const List *oldlist)
List * lappend_int(List *list, int datum)
List * lappend_oid(List *list, Oid datum)
void list_free(List *list)
bool list_member_oid(const List *list, Oid datum)
List * list_truncate(List *list, int new_size)
bool list_member(const List *list, const void *datum)
List * list_copy_head(const List *oldlist, int len)
List * list_append_unique_ptr(List *list, void *datum)
void get_op_opfamily_properties(Oid opno, Oid opfamily, bool ordering_op, int *strategy, Oid *lefttype, Oid *righttype)
Oid get_op_opfamily_sortfamily(Oid opno, Oid opfamily)
RegProcedure get_func_support(Oid funcid)
int get_op_opfamily_strategy(Oid opno, Oid opfamily)
Oid get_opfamily_member(Oid opfamily, Oid lefttype, Oid righttype, int16 strategy)
Oid get_array_type(Oid typid)
bool op_in_opfamily(Oid opno, Oid opfamily)
Oid get_commutator(Oid opno)
Expr * make_orclause(List *orclauses)
Node * makeBoolConst(bool value, bool isnull)
Expr * make_opclause(Oid opno, Oid opresulttype, bool opretset, Expr *leftop, Expr *rightop, Oid opcollid, Oid inputcollid)
void pfree(void *pointer)
Oid exprType(const Node *expr)
void set_opfuncid(OpExpr *opexpr)
#define expression_tree_mutator(n, m, c)
static bool is_andclause(const void *clause)
static Node * get_rightop(const void *clause)
static bool is_opclause(const void *clause)
#define expression_tree_walker(n, w, c)
static bool is_notclause(const void *clause)
static Expr * get_notclausearg(const void *notclause)
static Node * get_leftop(const void *clause)
#define IsA(nodeptr, _type_)
#define castNode(_type_, nodeptr)
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
List * truncate_useless_pathkeys(PlannerInfo *root, RelOptInfo *rel, List *pathkeys)
bool has_useful_pathkeys(PlannerInfo *root, RelOptInfo *rel)
List * build_index_pathkeys(PlannerInfo *root, IndexOptInfo *index, ScanDirection scandir)
BitmapAndPath * create_bitmap_and_path(PlannerInfo *root, RelOptInfo *rel, List *bitmapquals)
IndexPath * create_index_path(PlannerInfo *root, IndexOptInfo *index, List *indexclauses, List *indexorderbys, List *indexorderbycols, List *pathkeys, ScanDirection indexscandir, bool indexonly, Relids required_outer, double loop_count, bool partial_path)
void add_partial_path(RelOptInfo *parent_rel, Path *new_path)
BitmapOrPath * create_bitmap_or_path(PlannerInfo *root, RelOptInfo *rel, List *bitmapquals)
BitmapHeapPath * create_bitmap_heap_path(PlannerInfo *root, RelOptInfo *rel, Path *bitmapqual, Relids required_outer, double loop_count, int parallel_degree)
void add_path(RelOptInfo *parent_rel, Path *new_path)
#define IS_SIMPLE_REL(rel)
#define PATH_REQ_OUTER(path)
@ RELOPT_OTHER_MEMBER_REL
#define lfirst_node(type, lc)
static int list_length(const List *l)
static Oid list_nth_oid(const List *list, int n)
#define list_make1_oid(x1)
#define forthree(cell1, list1, cell2, list2, cell3, list3)
static void * list_nth(const List *list, int n)
static ListCell * list_head(const List *l)
static ListCell * lnext(const List *l, const ListCell *c)
#define list_make1_int(x1)
#define list_make2(x1, x2)
#define qsort(a, b, c, d)
static Datum PointerGetDatum(const void *X)
static Pointer DatumGetPointer(Datum X)
bool predicate_implied_by(List *predicate_list, List *clause_list, bool weak)
PlanRowMark * get_plan_rowmark(List *rowmarks, Index rtindex)
Relids find_childrel_parents(PlannerInfo *root, RelOptInfo *rel)
bool restriction_is_or_clause(RestrictInfo *restrictinfo)
bool restriction_is_securely_promotable(RestrictInfo *restrictinfo, RelOptInfo *rel)
RestrictInfo * make_plain_restrictinfo(PlannerInfo *root, Expr *clause, Expr *orclause, bool is_pushed_down, bool has_clone, bool is_clone, bool pseudoconstant, Index security_level, Relids required_relids, Relids incompatible_relids, Relids outer_relids)
bool join_clause_is_movable_to(RestrictInfo *rinfo, RelOptInfo *baserel)
RestrictInfo * commute_restrictinfo(RestrictInfo *rinfo, Oid comm_op)
#define make_simple_restrictinfo(root, clause)
double estimate_num_groups(PlannerInfo *root, List *groupExprs, double input_rows, List **pgset, EstimationInfo *estinfo)
#define BTGreaterStrategyNumber
#define BTLessStrategyNumber
#define BTLessEqualStrategyNumber
#define BTGreaterEqualStrategyNumber
BoolTestType booltesttype
List * indexclauses[INDEX_MAX_KEYS]
struct RestrictInfo * rinfo
Selectivity indexselectivity
struct PathTarget * reltarget
Relids incompatible_relids
#define FirstLowInvalidHeapAttributeNumber
#define FirstNormalObjectId
bool contain_var_clause(Node *node)
Relids pull_varnos(PlannerInfo *root, Node *node)
void pull_varattnos(Node *node, Index varno, Bitmapset **varattnos)