}
/*
- * If there are no dependencies on a column, give the statistics an auto
- * dependency on the whole table. In most cases, this will be redundant,
- * but it might not be if the statistics expressions contain no Vars
- * (which might seem strange but possible). This is consistent with what
- * we do for indexes in index_create.
+ * If there are no dependencies on a column, give the statistics object an
+ * auto dependency on the whole table. In most cases, this will be
+ * redundant, but it might not be if the statistics expressions contain no
+ * Vars (which might seem strange but possible). This is consistent with
+ * what we do for indexes in index_create.
*
* XXX We intentionally don't consider the expressions before adding this
* dependency, because recordDependencyOnSingleRelExpr may not create any
stxoid = get_statistics_object_oid(stmt->defnames, stmt->missing_ok);
/*
- * If we got here and the OID is not valid, it means the statistics does
- * not exist, but the command specified IF EXISTS. So report this as a
- * simple NOTICE and we're done.
+ * If we got here and the OID is not valid, it means the statistics object
+ * does not exist, but the command specified IF EXISTS. So report this as
+ * a simple NOTICE and we're done.
*/
if (!OidIsValid(stxoid))
{
}
/*
- * Select a nonconflicting name for a new statistics.
+ * Select a nonconflicting name for a new statistics object.
*
* name1, name2, and label are used the same way as for makeObjectName(),
* except that the label can't be NULL; digits will be appended to the label
}
/*
- * Generate "name2" for a new statistics given the list of column names for it
- * This will be passed to ChooseExtendedStatisticName along with the parent
- * table name and a suitable label.
+ * Generate "name2" for a new statistics object given the list of column
+ * names for it. This will be passed to ChooseExtendedStatisticName along
+ * with the parent table name and a suitable label.
*
* We know that less than NAMEDATALEN characters will actually be used,
* so we can truncate the result once we've generated that many.
}
/*
- * StatisticsGetRelation: given a statistics's relation OID, get the OID of
- * the relation it is an statistics on. Uses the system cache.
+ * StatisticsGetRelation: given a statistics object's OID, get the OID of
+ * the relation it is defined on. Uses the system cache.
*/
Oid
StatisticsGetRelation(Oid statId, bool missing_ok)
/*
* This de-duplication check is critical for two independent reasons: we
* mustn't try to recreate the same statistics object twice, and if the
- * statistics depends on more than one column whose type is to be altered,
- * we must capture its definition string before applying any of the type
- * changes. ruleutils.c will get confused if we ask again later.
+ * statistics object depends on more than one column whose type is to be
+ * altered, we must capture its definition string before applying any of
+ * the type changes. ruleutils.c will get confused if we ask again later.
*/
if (!list_member_oid(tab->changedStatisticsOids, stxoid))
{
- /* OK, capture the index's existing definition string */
+ /* OK, capture the statistics object's existing definition string */
char *defstring = pg_get_statisticsobjdef_string(stxoid);
tab->changedStatisticsOids = lappend_oid(tab->changedStatisticsOids,
/*
* transformStatsStmt - parse analysis for CREATE STATISTICS
*
- * To avoid race conditions, it's important that this function rely only on
+ * To avoid race conditions, it's important that this function relies only on
* the passed-in relid (and not on stmt->relation) to determine the target
* relation.
*/
if (list_length(pstate->p_rtable) != 1)
ereport(ERROR,
(errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
- errmsg("statistics expressions can refer only to the table being indexed")));
+ errmsg("statistics expressions can refer only to the table being referenced")));
free_parsestate(pstate);
newcmds = lappend(newcmds, newcmd);
}
- /* Append extended statistic objects */
+ /* Append extended statistics objects */
transformExtendedStatistics(&cxt);
/* Close rel */
continue;
}
- /* compute statistics target for this statistics */
+ /* compute statistics target for this statistics object */
stattarget = statext_compute_stattarget(stat->stattarget,
bms_num_members(stat->columns),
stats);
if (stattarget == 0)
continue;
- /* evaluate expressions (if the statistics has any) */
+ /* evaluate expressions (if the statistics object has any) */
data = make_build_data(onerel, stat, numrows, rows, stats, stattarget);
/* compute statistic of each requested type */
* when analyzing only some of the columns, this will skip statistics objects
* that would require additional columns.
*
- * See statext_compute_stattarget for details about how we compute statistics
- * target for a statistics object (from the object target, attribute targets
- * and default statistics target).
+ * See statext_compute_stattarget for details about how we compute the
+ * statistics target for a statistics object (from the object target,
+ * attribute targets and default statistics target).
*/
int
ComputeExtStatisticsRows(Relation onerel,
*
* When computing target for extended statistics objects, we consider three
* places where the target may be set - the statistics object itself,
- * attributes the statistics is defined on, and then the default statistics
- * target.
+ * attributes the statistics object is defined on, and then the default
+ * statistics target.
*
* First we look at what's set for the statistics object itself, using the
* ALTER STATISTICS ... SET STATISTICS command. If we find a valid value
/*
* The clause was not estimated yet, and we've extracted either
- * attnums of expressions from it. Ignore it if it's not fully
- * covered by the chosen statistics.
+ * attnums or expressions from it. Ignore it if it's not fully
+ * covered by the chosen statistics object.
*
* We need to check both attributes and expressions, and reject if
* either is not covered.
* 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)
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)
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);
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;
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)
{
{
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;
/*
* 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.
*/