Add pg_restore_extended_stats() This function closely mirror its relation and attribute counterparts, but for extended statistics (i.e. CREATE STATISTICS) objects, being able to restore extended statistics for an extended stats object. Like the other functions, the goal of this feature is to ease the dump or upgrade of clusters so as ANALYZE would not be required anymore after these operations, stats being directly loaded into the target cluster without any post-dump/upgrade computation.
The caller of this function needs the following arguments for the extended stats to restore: - The name of the relation. - The schema name of the relation. - The name of the extended stats object. - The schema name of the extended stats object. - If the stats are inherited or not. - One or more extended stats kind with its data. This commit adds only support for the restore of the extended statistics kind "n_distinct", building the basic infrastructure for the restore of more extended statistics kinds in follow-up commits, including MVC and dependencies. The support for "n_distinct" is eased in this commit thanks to the previous work done particularly in commits 1f927cce4498 and 44eba8f06e55, that have added the input function for the type pg_ndistinct, used as data type in input of this new restore function. Bump catalog version. Author: Corey Huinker <[email protected]> Co-authored-by: Michael Paquier <[email protected]> Reviewed-by: Chao Li <[email protected]> Discussion: https://postgr.es/m/CADkLM=dpz3KFnqP-dgJ-zvRvtjsa8UZv8wDAQdqho=qn3kx...@mail.gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/0e80f3f88deaefc03e5fd204190daab6f761e73d Modified Files -------------- doc/src/sgml/func/func-admin.sgml | 79 +++++++ src/backend/statistics/extended_stats_funcs.c | 320 ++++++++++++++++++++++++++ src/include/catalog/catversion.h | 2 +- src/include/catalog/pg_proc.dat | 5 + src/test/regress/expected/stats_import.out | 147 ++++++++++++ src/test/regress/sql/stats_import.sql | 105 +++++++++ src/tools/pgindent/typedefs.list | 1 + 7 files changed, 658 insertions(+), 1 deletion(-)
