aboutsummaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/optimizer/util/plancat.c1
-rw-r--r--src/backend/statistics/dependencies.c9
-rw-r--r--src/backend/statistics/extended_stats.c7
-rw-r--r--src/backend/utils/cache/relcache.c1
4 files changed, 12 insertions, 6 deletions
diff --git a/src/backend/optimizer/util/plancat.c b/src/backend/optimizer/util/plancat.c
index faebfeddb2c..28322cec0e8 100644
--- a/src/backend/optimizer/util/plancat.c
+++ b/src/backend/optimizer/util/plancat.c
@@ -79,6 +79,7 @@ static List *get_relation_statistics(RelOptInfo *rel, Relation relation);
* min_attr lowest valid AttrNumber
* max_attr highest valid AttrNumber
* indexlist list of IndexOptInfos for relation's indexes
+ * statlist list of StatisticExtInfo for relation's statistic objects
* serverid if it's a foreign table, the server OID
* fdwroutine if it's a foreign table, the FDW function pointers
* pages number of pages
diff --git a/src/backend/statistics/dependencies.c b/src/backend/statistics/dependencies.c
index fb958e1b0a5..159ddb87233 100644
--- a/src/backend/statistics/dependencies.c
+++ b/src/backend/statistics/dependencies.c
@@ -900,7 +900,13 @@ find_strongest_dependency(StatisticExtInfo * stats, MVDependencies * dependencie
/*
* dependencies_clauselist_selectivity
- * Attempt to estimate selectivity using functional dependency statistics
+ * Return the estimated selectivity of the given clauses using
+ * functional dependency statistics, or 1.0 if no useful functional
+ * dependency statistic exists.
+ *
+ * 'estimatedclauses' is an output argument that gets a bit set corresponding
+ * to the (zero-based) list index of clauses that are included in the
+ * estimated selectivity.
*
* Given equality clauses on attributes (a,b) we find the strongest dependency
* between them, i.e. either (a=>b) or (b=>a). Assuming (a=>b) is the selected
@@ -935,7 +941,6 @@ dependencies_clauselist_selectivity(PlannerInfo *root,
AttrNumber *list_attnums;
int listidx;
-
/* check if there's any stats that might be useful for us. */
if (!has_stats_of_kind(rel->statlist, STATS_EXT_DEPENDENCIES))
return 1.0;
diff --git a/src/backend/statistics/extended_stats.c b/src/backend/statistics/extended_stats.c
index 006bb897c48..4b3aa778140 100644
--- a/src/backend/statistics/extended_stats.c
+++ b/src/backend/statistics/extended_stats.c
@@ -408,7 +408,7 @@ multi_sort_compare_dims(int start, int end,
/*
* has_stats_of_kind
- * Check that the list contains statistic of a given kind
+ * Check that the list contains statistic of a given kind
*/
bool
has_stats_of_kind(List *stats, char requiredkind)
@@ -428,8 +428,9 @@ has_stats_of_kind(List *stats, char requiredkind)
/*
* choose_best_statistics
- * Look for statistics with the specified 'requiredkind' which have keys
- * that match at least two attnums.
+ * Look for and return statistics with the specified 'requiredkind' which
+ * have keys that match at least two of the given attnums. Return NULL if
+ * there's no match.
*
* The current selection criteria is very simple - we choose the statistics
* referencing the most attributes with the least keys.
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index 24ffea8f407..ddb948528b3 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -4508,7 +4508,6 @@ RelationGetStatExtList(Relation relation)
NULL, 1, &skey);
while (HeapTupleIsValid(htup = systable_getnext(indscan)))
- /* TODO maybe include only already built statistics? */
result = insert_ordered_oid(result, HeapTupleGetOid(htup));
systable_endscan(indscan);