diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2017-05-14 10:54:47 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2017-05-14 10:55:01 -0400 |
commit | f04c9a61468904b6815b2bc73a48878817766e0e (patch) | |
tree | b8eb1b9a131023b1ab0f7e151e036988d02eb8a3 /src/backend/utils/adt/selfuncs.c | |
parent | 12ad38b3b4b5004001a525e0a0eda2ec45329e8e (diff) | |
download | postgresql-f04c9a61468904b6815b2bc73a48878817766e0e.tar.gz postgresql-f04c9a61468904b6815b2bc73a48878817766e0e.zip |
Standardize terminology for pg_statistic_ext entries.
Consistently refer to such an entry as a "statistics object", not just
"statistics" or "extended statistics". Previously we had a mismash of
terms, accompanied by utter confusion as to whether the term was
singular or plural. That's not only grating (at least to the ear of
a native English speaker) but could be outright misleading, eg in error
messages that seemed to be referring to multiple objects where only one
could be meant.
This commit fixes the code and a lot of comments (though I may have
missed a few). I also renamed two new SQL functions,
pg_get_statisticsextdef -> pg_get_statisticsobjdef
pg_statistic_ext_is_visible -> pg_statistics_obj_is_visible
to conform better with this terminology.
I have not touched the SGML docs other than fixing those function
names; the docs certainly need work but it seems like a separable task.
Discussion: https://postgr.es/m/22676.1494557205@sss.pgh.pa.us
Diffstat (limited to 'src/backend/utils/adt/selfuncs.c')
-rw-r--r-- | src/backend/utils/adt/selfuncs.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c index 6c4cef9fb33..7028d6387c7 100644 --- a/src/backend/utils/adt/selfuncs.c +++ b/src/backend/utils/adt/selfuncs.c @@ -3707,25 +3707,27 @@ estimate_multivariate_ndistinct(PlannerInfo *root, RelOptInfo *rel, { StatisticExtInfo *info = (StatisticExtInfo *) lfirst(lc); Bitmapset *shared; + int nshared; /* skip statistics of other kinds */ if (info->kind != STATS_EXT_NDISTINCT) continue; - /* compute attnums shared by the vars and the statistic */ + /* compute attnums shared by the vars and the statistics object */ shared = bms_intersect(info->keys, attnums); + nshared = bms_num_members(shared); /* - * Does this statistics matches more columns than the currently - * best statistic? If so, use this one instead. + * Does this statistics object match more columns than the currently + * best object? If so, use this one instead. * - * XXX This should break ties using name of the statistic, or - * something like that, to make the outcome stable. + * XXX This should break ties using name of the object, or something + * like that, to make the outcome stable. */ - if (bms_num_members(shared) > nmatches) + if (nshared > nmatches) { statOid = info->statOid; - nmatches = bms_num_members(shared); + nmatches = nshared; matched = shared; } } |