summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorTom Lane2019-02-15 18:05:19 +0000
committerTom Lane2019-02-15 18:05:19 +0000
commite89f14e2bb9f7c392c4c85a53ab5a13ea2aed83d (patch)
treebb5a4ac8c74d16bff4f4833b019b22579c6da401 /src/include
parentfc6c72747ae6db6909fcd7d1adbc3d923ec1fffa (diff)
Refactor index cost estimation functions in view of IndexClause changes.
Get rid of deconstruct_indexquals() in favor of just iterating over the IndexClause list directly. The extra services that that function used to provide, such as hiding clause commutation and associating the right index column with each clause, are no longer useful given the new data structure. I'd originally thought that it'd provide a useful amount of abstraction by freeing callers from paying attention to the exact clause type of each indexqual, but that hope proves to have been vain, because few callers can ignore the semantic differences between different clause types. Indeed, removing it results in a net code savings, and probably some cycles shaved by not having to build an extra list-of-structs data structure. Also, export a few formerly-static support functions, with the goal of allowing extension AMs to write functionality equivalent to genericcostestimate() without pointless code duplication. Discussion: https://postgr.es/m/24586.1550106354@sss.pgh.pa.us
Diffstat (limited to 'src/include')
-rw-r--r--src/include/utils/selfuncs.h20
1 files changed, 5 insertions, 15 deletions
diff --git a/src/include/utils/selfuncs.h b/src/include/utils/selfuncs.h
index 8829889f9f5..0ce2175f3e8 100644
--- a/src/include/utils/selfuncs.h
+++ b/src/include/utils/selfuncs.h
@@ -85,19 +85,6 @@ typedef struct VariableStatData
/*
- * deconstruct_indexquals is a simple function to examine the indexquals
- * attached to a proposed IndexPath. It returns a list of IndexQualInfo
- * structs, one per qual expression.
- */
-typedef struct
-{
- RestrictInfo *rinfo; /* the indexqual itself */
- int indexcol; /* zero-based index column number */
- Oid clause_op; /* qual's operator OID, if relevant */
- Node *other_operand; /* non-index operand of qual's operator */
-} IndexQualInfo;
-
-/*
* genericcostestimate is a general-purpose estimator that can be used for
* most index types. In some cases we use genericcostestimate as the base
* code and then incorporate additional index-type-specific knowledge in
@@ -200,10 +187,13 @@ extern void estimate_hash_bucket_stats(PlannerInfo *root,
Selectivity *mcv_freq,
Selectivity *bucketsize_frac);
-extern List *deconstruct_indexquals(IndexPath *path);
+extern List *get_quals_from_indexclauses(List *indexclauses);
+extern Cost index_other_operands_eval_cost(PlannerInfo *root,
+ List *indexquals);
+extern List *add_predicate_to_index_quals(IndexOptInfo *index,
+ List *indexQuals);
extern void genericcostestimate(PlannerInfo *root, IndexPath *path,
double loop_count,
- List *qinfos,
GenericCosts *costs);
/* Functions in array_selfuncs.c */