git.postgresql.org Git - postgresql.git/commit

git projects / postgresql.git / commit
? search:
summary | shortlog | log | commit | commitdiff | tree
(parent: bca6e64) | patch
Allow setting statistics target for extended statistics
2019年9月10日 18:09:27 +0000 (20:09 +0200)
2019年9月10日 22:25:51 +0000 (00:25 +0200)
commit d06215d03b50c264a0f31e335b895ee1b6753e68
Allow setting statistics target for extended statistics

When building statistics, we need to decide how many rows to sample and
how accurate the resulting statistics should be. Until now, it was not
possible to explicitly define statistics target for extended statistics
objects, the value was always computed from the per-attribute targets
with a fallback to the system-wide default statistics target.

That's a bit inconvenient, as it ties together the statistics target set
for per-column and extended statistics. In some cases it may be useful
to require larger sample / higher accuracy for extended statics (or the
other way around), but with this approach that's not possible.

So this commit introduces a new command, allowing to specify statistics
target for individual extended statistics objects, overriding the value
derived from per-attribute targets (and the system default).

ALTER STATISTICS stat_name SET STATISTICS target_value;

When determining statistics target for an extended statistics object we
first look at this explicitly set value. When this value is -1, we fall
back to the old formula, looking at the per-attribute targets first and
then the system default. This means the behavior is backwards compatible
with older PostgreSQL releases.

Author: Tomas Vondra
Discussion: https://postgr.es/m/20190618213357.vli3i23vpkset2xd@development
Reviewed-by: Kirk Jamison, Dean Rasheed
22 files changed:
doc/src/sgml/ref/alter_statistics.sgml diff | blob | blame | history
src/backend/commands/analyze.c diff | blob | blame | history
src/backend/commands/statscmds.c diff | blob | blame | history
src/backend/nodes/copyfuncs.c diff | blob | blame | history
src/backend/nodes/equalfuncs.c diff | blob | blame | history
src/backend/nodes/outfuncs.c diff | blob | blame | history
src/backend/parser/gram.y diff | blob | blame | history
src/backend/statistics/extended_stats.c diff | blob | blame | history
src/backend/statistics/mcv.c diff | blob | blame | history
src/backend/tcop/utility.c diff | blob | blame | history
src/bin/pg_dump/pg_dump.c diff | blob | blame | history
src/bin/pg_dump/pg_dump.h diff | blob | blame | history
src/bin/pg_dump/t/002_pg_dump.pl diff | blob | blame | history
src/bin/psql/tab-complete.c diff | blob | blame | history
src/include/catalog/pg_statistic_ext.h diff | blob | blame | history
src/include/commands/defrem.h diff | blob | blame | history
src/include/nodes/nodes.h diff | blob | blame | history
src/include/nodes/parsenodes.h diff | blob | blame | history
src/include/statistics/extended_stats_internal.h diff | blob | blame | history
src/include/statistics/statistics.h diff | blob | blame | history
src/test/regress/expected/stats_ext.out diff | blob | blame | history
src/test/regress/sql/stats_ext.sql diff | blob | blame | history
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /