Comment fixes for extended statistics
Clean up some code comments in new extended statistics code, from 7b504eb282.
This commit is contained in:
parent
dc0400cc50
commit
b1fc51a36e
src
backend
include/nodes
@ -79,6 +79,7 @@ static List *get_relation_statistics(RelOptInfo *rel, Relation relation);
|
|||||||
* min_attr lowest valid AttrNumber
|
* min_attr lowest valid AttrNumber
|
||||||
* max_attr highest valid AttrNumber
|
* max_attr highest valid AttrNumber
|
||||||
* indexlist list of IndexOptInfos for relation's indexes
|
* 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
|
* serverid if it's a foreign table, the server OID
|
||||||
* fdwroutine if it's a foreign table, the FDW function pointers
|
* fdwroutine if it's a foreign table, the FDW function pointers
|
||||||
* pages number of pages
|
* pages number of pages
|
||||||
|
@ -900,7 +900,13 @@ find_strongest_dependency(StatisticExtInfo * stats, MVDependencies * dependencie
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* dependencies_clauselist_selectivity
|
* 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
|
* 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
|
* 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;
|
AttrNumber *list_attnums;
|
||||||
int listidx;
|
int listidx;
|
||||||
|
|
||||||
|
|
||||||
/* check if there's any stats that might be useful for us. */
|
/* check if there's any stats that might be useful for us. */
|
||||||
if (!has_stats_of_kind(rel->statlist, STATS_EXT_DEPENDENCIES))
|
if (!has_stats_of_kind(rel->statlist, STATS_EXT_DEPENDENCIES))
|
||||||
return 1.0;
|
return 1.0;
|
||||||
|
@ -408,7 +408,7 @@ multi_sort_compare_dims(int start, int end,
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* has_stats_of_kind
|
* 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
|
bool
|
||||||
has_stats_of_kind(List *stats, char requiredkind)
|
has_stats_of_kind(List *stats, char requiredkind)
|
||||||
@ -428,8 +428,9 @@ has_stats_of_kind(List *stats, char requiredkind)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* choose_best_statistics
|
* choose_best_statistics
|
||||||
* Look for statistics with the specified 'requiredkind' which have keys
|
* Look for and return statistics with the specified 'requiredkind' which
|
||||||
* that match at least two attnums.
|
* 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
|
* The current selection criteria is very simple - we choose the statistics
|
||||||
* referencing the most attributes with the least keys.
|
* referencing the most attributes with the least keys.
|
||||||
|
1
src/backend/utils/cache/relcache.c
vendored
1
src/backend/utils/cache/relcache.c
vendored
@ -4508,7 +4508,6 @@ RelationGetStatExtList(Relation relation)
|
|||||||
NULL, 1, &skey);
|
NULL, 1, &skey);
|
||||||
|
|
||||||
while (HeapTupleIsValid(htup = systable_getnext(indscan)))
|
while (HeapTupleIsValid(htup = systable_getnext(indscan)))
|
||||||
/* TODO maybe include only already built statistics? */
|
|
||||||
result = insert_ordered_oid(result, HeapTupleGetOid(htup));
|
result = insert_ordered_oid(result, HeapTupleGetOid(htup));
|
||||||
|
|
||||||
systable_endscan(indscan);
|
systable_endscan(indscan);
|
||||||
|
@ -693,17 +693,15 @@ typedef struct ForeignKeyOptInfo
|
|||||||
* StatisticExtInfo
|
* StatisticExtInfo
|
||||||
* Information about extended statistics for planning/optimization
|
* Information about extended statistics for planning/optimization
|
||||||
*
|
*
|
||||||
* This contains information about which columns are covered by the
|
* Each pg_statistic_ext row is represented by one or more nodes of this
|
||||||
* statistics (stakeys), which options were requested while adding the
|
* type, or even zero if ANALYZE has not computed them.
|
||||||
* statistics (*_enabled), and which kinds of statistics were actually
|
|
||||||
* built and are available for the optimizer (*_built).
|
|
||||||
*/
|
*/
|
||||||
typedef struct StatisticExtInfo
|
typedef struct StatisticExtInfo
|
||||||
{
|
{
|
||||||
NodeTag type;
|
NodeTag type;
|
||||||
|
|
||||||
Oid statOid; /* OID of the statistics row */
|
Oid statOid; /* OID of the statistics row */
|
||||||
RelOptInfo *rel; /* back-link to index's table */
|
RelOptInfo *rel; /* back-link to statistic's table */
|
||||||
char kind; /* statistic kind of this entry */
|
char kind; /* statistic kind of this entry */
|
||||||
Bitmapset *keys; /* attnums of the columns covered */
|
Bitmapset *keys; /* attnums of the columns covered */
|
||||||
} StatisticExtInfo;
|
} StatisticExtInfo;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user