From 2cf9cf5d7b5e66202389618a4c08945da352b35c Mon Sep 17 00:00:00 2001 From: Michael Paquier Date: Wed, 29 Sep 2021 15:29:45 +0900 Subject: Clarify use of "statistics objects" in the code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The code inconsistently used "statistic object" or "statistics" where the correct term, as discussed, is actually "statistics object". This improves the state of the code to be more consistent. While on it, fix an incorrect error message introduced in a4d75c8. This error should never happen, as the code states, but it would be misleading. Author: Justin Pryzby Reviewed-by: Álvaro Herrera, Michael Paquier Discussion: https://postgr.es/m/20210924215827.GS831@telsasoft.com Backpatch-through: 14 --- src/backend/utils/adt/selfuncs.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src/backend/utils/adt') diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c index 0c8c05f6c2e..60549d76b7a 100644 --- a/src/backend/utils/adt/selfuncs.c +++ b/src/backend/utils/adt/selfuncs.c @@ -3443,13 +3443,13 @@ estimate_num_groups(PlannerInfo *root, List *groupExprs, double input_rows, * expression, treat it as a single variable even if it's really more * complicated. * - * XXX This has the consequence that if there's a statistics on the - * expression, we don't split it into individual Vars. This affects - * our selection of statistics in estimate_multivariate_ndistinct, - * because it's probably better to use more accurate estimate for each - * expression and treat them as independent, than to combine estimates - * for the extracted variables when we don't know how that relates to - * the expressions. + * XXX This has the consequence that if there's a statistics object on + * the expression, we don't split it into individual Vars. This + * affects our selection of statistics in + * estimate_multivariate_ndistinct, because it's probably better to + * use more accurate estimate for each expression and treat them as + * independent, than to combine estimates for the extracted variables + * when we don't know how that relates to the expressions. */ examine_variable(root, groupexpr, 0, &vardata); if (HeapTupleIsValid(vardata.statsTuple) || vardata.isunique) @@ -3918,7 +3918,7 @@ estimate_multivariate_ndistinct(PlannerInfo *root, RelOptInfo *rel, if (!rel->statlist) return false; - /* look for the ndistinct statistics matching the most vars */ + /* look for the ndistinct statistics object matching the most vars */ nmatches_vars = 0; /* we require at least two matches */ nmatches_exprs = 0; foreach(lc, rel->statlist) @@ -3964,7 +3964,7 @@ estimate_multivariate_ndistinct(PlannerInfo *root, RelOptInfo *rel, continue; } - /* expression - see if it's in the statistics */ + /* expression - see if it's in the statistics object */ foreach(lc3, info->exprs) { Node *expr = (Node *) lfirst(lc3); @@ -4053,7 +4053,7 @@ estimate_multivariate_ndistinct(PlannerInfo *root, RelOptInfo *rel, if (!AttrNumberIsForUserDefinedAttr(attnum)) continue; - /* Is the variable covered by the statistics? */ + /* Is the variable covered by the statistics object? */ if (!bms_is_member(attnum, matched_info->keys)) continue; @@ -4075,7 +4075,7 @@ estimate_multivariate_ndistinct(PlannerInfo *root, RelOptInfo *rel, if (found) continue; - /* expression - see if it's in the statistics */ + /* expression - see if it's in the statistics object */ idx = 0; foreach(lc3, matched_info->exprs) { @@ -5252,7 +5252,7 @@ examine_variable(PlannerInfo *root, Node *node, int varRelid, { HeapTuple t = statext_expressions_load(info->statOid, pos); - /* Get index's table for permission check */ + /* Get statistics object's table for permission check */ RangeTblEntry *rte; Oid userid; @@ -5276,8 +5276,8 @@ examine_variable(PlannerInfo *root, Node *node, int varRelid, /* * For simplicity, we insist on the whole table being * selectable, rather than trying to identify which - * column(s) the statistics depends on. Also require all - * rows to be selectable --- there must be no + * column(s) the statistics object depends on. Also + * require all rows to be selectable --- there must be no * securityQuals from security barrier views or RLS * policies. */ -- cgit v1.2.3