From 03b5a74d81cfcdf792a6c653cc4d27dc622e4115 Mon Sep 17 00:00:00 2001 From: Alexey Makhmutov Date: Tue, 21 Feb 2023 12:59:12 +0300 Subject: [PATCH 1/6] Prepare extension for PostgreSQL 15 --- Makefile | 4 ++-- SPECS/pg_dbms_stats.spec | 24 +++++++++---------- ...e => export_effective_stats-15.sql.sample} | 0 ...ample => export_plain_stats-15.sql.sample} | 0 doc/objects-en.md | 2 +- doc/objects-ja.md | 2 +- doc/pg_dbms_stats-en.md | 4 ++-- doc/pg_dbms_stats-ja.md | 4 ++-- ...stats--14.0.sql => pg_dbms_stats--15.0.sql | 0 pg_dbms_stats.control | 2 +- 10 files changed, 21 insertions(+), 21 deletions(-) rename doc/{export_effective_stats-14.sql.sample => export_effective_stats-15.sql.sample} (100%) rename doc/{export_plain_stats-14.sql.sample => export_plain_stats-15.sql.sample} (100%) rename pg_dbms_stats--14.0.sql => pg_dbms_stats--15.0.sql (100%) diff --git a/Makefile b/Makefile index 1706aa5..d26de12 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # pg_dbms_stats/Makefile -DBMSSTATSVER = 14.0 -PGVERS = 14 +DBMSSTATSVER = 15.0 +PGVERS = 15 MODULE_big = pg_dbms_stats OBJS = pg_dbms_stats.o dump.o import.o diff --git a/SPECS/pg_dbms_stats.spec b/SPECS/pg_dbms_stats.spec index 6649f80..5467704 100644 --- a/SPECS/pg_dbms_stats.spec +++ b/SPECS/pg_dbms_stats.spec @@ -1,7 +1,7 @@ # SPEC file for pg_dbms_stats14 # Copyright(c) 2012-2022, NIPPON TELEGRAPH AND TELEPHONE CORPORATION -%define _pgdir /usr/pgsql-14 +%define _pgdir /usr/pgsql-15 %define _bindir %{_pgdir}/bin %define _libdir %{_pgdir}/lib %define _datadir %{_pgdir}/share @@ -14,9 +14,9 @@ %endif ## Set general information for pg_dbms_stats. -Summary: Plan Stabilizer for PostgreSQL 14 +Summary: Plan Stabilizer for PostgreSQL 15 Name: pg_dbms_stats -Version: 14.0 +Version: 15.0 Release: 1%{?dist} License: BSD Group: Applications/Databases @@ -39,25 +39,25 @@ pg_dbms_stats also provides following features: - backup multiple generations of planner statistics to reuse plans afterwards - import planner statistics from another system for tuning or testing. -Note that this package is available for only PostgreSQL 14. +Note that this package is available for only PostgreSQL 15. %package llvmjit -Requires: postgresql14-server, postgresql14-llvmjit -Requires: pg_dbms_stats = 14.0 -Summary: Just-in-time compilation support for pg_dbms_stats 14 +Requires: postgresql15-server, postgresql15-llvmjit +Requires: pg_dbms_stats = 15.0 +Summary: Just-in-time compilation support for pg_dbms_stats 15 %description llvmjit -Just-in-time compilation support for pg_dmbs_stats 14 +Just-in-time compilation support for pg_dmbs_stats 15 ## pre work for build pg_dbms_stats %prep -PATH=/usr/pgsql-14/bin:$PATH +PATH=/usr/pgsql-15/bin:$PATH if [ ! -d %{_rpmdir} ]; then mkdir -p %{_rpmdir}; fi %setup -q ## Set variables for build environment %build -PATH=/usr/pgsql-14/bin:$PATH +PATH=/usr/pgsql-15/bin:$PATH make USE_PGXS=1 %{?_smp_mflags} ## Set variables for install @@ -74,8 +74,8 @@ rm -rf %{buildroot} %defattr(0644,root,root) %{_datadir}/extension/pg_dbms_stats--%{version}.sql %{_datadir}/extension/pg_dbms_stats.control -%{_docdir}/extension/export_effective_stats-14.sql.sample -%{_docdir}/extension/export_plain_stats-14.sql.sample +%{_docdir}/extension/export_effective_stats-15.sql.sample +%{_docdir}/extension/export_plain_stats-15.sql.sample %files llvmjit %{_bcdir} diff --git a/doc/export_effective_stats-14.sql.sample b/doc/export_effective_stats-15.sql.sample similarity index 100% rename from doc/export_effective_stats-14.sql.sample rename to doc/export_effective_stats-15.sql.sample diff --git a/doc/export_plain_stats-14.sql.sample b/doc/export_plain_stats-15.sql.sample similarity index 100% rename from doc/export_plain_stats-14.sql.sample rename to doc/export_plain_stats-15.sql.sample diff --git a/doc/objects-en.md b/doc/objects-en.md index afde66b..a73f2e3 100644 --- a/doc/objects-en.md +++ b/doc/objects-en.md @@ -1,4 +1,4 @@ -# pg_dbms_stats 14.0 +# pg_dbms_stats 15.0 [pg_dms_stats](pg_dbms_stats-en.md) -> [Appendix A. Object List](objects-en.md) diff --git a/doc/objects-ja.md b/doc/objects-ja.md index fe2321f..c7caa4e 100644 --- a/doc/objects-ja.md +++ b/doc/objects-ja.md @@ -1,4 +1,4 @@ -# pg_dbms_stats 14.0 +# pg_dbms_stats 15.0 [pg_dms_stats](pg_dbms_stats-ja.md) -> [Appendix A. オブジェクト一覧](objects-ja.md) diff --git a/doc/pg_dbms_stats-en.md b/doc/pg_dbms_stats-en.md index cd859d4..8c0a5c4 100644 --- a/doc/pg_dbms_stats-en.md +++ b/doc/pg_dbms_stats-en.md @@ -18,7 +18,7 @@ -# pg_dbms_stats 14.0 +# pg_dbms_stats 15.0 --- ## NAME @@ -456,7 +456,7 @@ You can inject values by the following three steps. ## ENVIRONMENT PostgreSQL -14 +15 OS RHEL 7/8 diff --git a/doc/pg_dbms_stats-ja.md b/doc/pg_dbms_stats-ja.md index ad4bb77..f3372e1 100644 --- a/doc/pg_dbms_stats-ja.md +++ b/doc/pg_dbms_stats-ja.md @@ -18,7 +18,7 @@ -# pg_dbms_stats 14.0 +# pg_dbms_stats 15.0 ## 名前 @@ -449,7 +449,7 @@ pg_dbms_statsの各機能は、前節で説明した独自の統計情報テー ## 動作環境 PostgreSQLバージョン -PostgreSQL 14 +PostgreSQL 15 OS RHEL 7/8 diff --git a/pg_dbms_stats--14.0.sql b/pg_dbms_stats--15.0.sql similarity index 100% rename from pg_dbms_stats--14.0.sql rename to pg_dbms_stats--15.0.sql diff --git a/pg_dbms_stats.control b/pg_dbms_stats.control index fd7c4d1..6f569cd 100644 --- a/pg_dbms_stats.control +++ b/pg_dbms_stats.control @@ -1,7 +1,7 @@ # pg_dbms_stats extension comment = 'stabilize plans by fixing statistics' -default_version = '14.0' +default_version = '15.0' module_pathname = '$libdir/pg_dbms_stats' relocatable = false schema = dbms_stats From cfb298e71c1b275c8381521e09fd03edf4f1962f Mon Sep 17 00:00:00 2001 From: Alexey Makhmutov Date: Tue, 21 Feb 2023 16:05:08 +0300 Subject: [PATCH 2/6] Adapt regression tests to changes in PGXS 15 (removal of dynamic translation) --- Makefile | 2 - expected/.gitignore | 2 - .../ut_fdw_init.out | 6 +- expected/ut_imp_exp.out | 216 +- input/ut_imp_exp.source | 302 -- output/ut_imp_exp.source | 2417 ----------------- sql/.gitignore | 2 - .../ut_fdw_init.source => sql/ut_fdw_init.sql | 7 +- sql/ut_imp_exp.sql | 204 +- 9 files changed, 221 insertions(+), 2937 deletions(-) rename input/ut_fdw_init.source => expected/ut_fdw_init.out (50%) delete mode 100644 input/ut_imp_exp.source delete mode 100644 output/ut_imp_exp.source rename output/ut_fdw_init.source => sql/ut_fdw_init.sql (50%) diff --git a/Makefile b/Makefile index d26de12..3d6468c 100644 --- a/Makefile +++ b/Makefile @@ -34,8 +34,6 @@ STARBALLS = $(STARBALL) $(foreach v,$(PGVERS),pg_dbms_stats$(v).tar.gz) RPMS = $(foreach v,$(PGVERS),rpm$(v)) EXTRA_CLEAN = sql/ut_anyarray-*.sql expected/ut_anyarray-*.out \ - sql/ut_imp_exp-*.sql expected/ut_imp_exp-*.out \ - sql/ut_fdw_init.sql expected/ut_fdw_init.out \ export_stats.dmp ut-fdw.csv $(STARBALLS) RPMS/*/* \ *~ diff --git a/expected/.gitignore b/expected/.gitignore index 6301774..191791a 100644 --- a/expected/.gitignore +++ b/expected/.gitignore @@ -1,3 +1 @@ /ut_anyarray-*.out -/ut_imp_exp-*.out -/ut_fdw_init.out diff --git a/input/ut_fdw_init.source b/expected/ut_fdw_init.out similarity index 50% rename from input/ut_fdw_init.source rename to expected/ut_fdw_init.out index 5b2d375..ca6c6ee 100644 --- a/input/ut_fdw_init.source +++ b/expected/ut_fdw_init.out @@ -1,8 +1,10 @@ +\getenv abs_srcdir PG_ABS_SRCDIR +\set csv_path :abs_srcdir '/ut-fdw.csv' CREATE EXTENSION file_fdw; CREATE SERVER test_server FOREIGN DATA WRAPPER file_fdw; CREATE FOREIGN TABLE s0.sft0(id integer) SERVER test_server - OPTIONS (filename '@abs_srcdir@/ut-fdw.csv', + OPTIONS (filename :'csv_path', format 'csv'); -\! cp @abs_srcdir@/input/ut-fdw.csv @abs_srcdir@/ut-fdw.csv +\! cp $PG_ABS_SRCDIR/input/ut-fdw.csv $PG_ABS_SRCDIR/ut-fdw.csv diff --git a/expected/ut_imp_exp.out b/expected/ut_imp_exp.out index 1dd2fbd..2140aee 100644 --- a/expected/ut_imp_exp.out +++ b/expected/ut_imp_exp.out @@ -1,7 +1,9 @@ +\getenv abs_srcdir PG_ABS_SRCDIR +\set dump_path :abs_srcdir '/export_stats.dmp' \pset null '(null)' CREATE TABLE s0.st3(); /* - * No.16-1 export_plain_stats-14.sql.sample + * No.16-1 export_plain_stats-15.sql.sample */ -- No.16-1-1 ANALYZE; @@ -60,7 +62,7 @@ UPDATE dbms_stats.column_stats_locked SET stavalues3 = stavalues1, stavalues4 = stavalues4, stavalues5 = stavalues5; -\i doc/export_plain_stats-14.sql.sample +\i doc/export_plain_stats-15.sql.sample /* * If you want the statistics of per-relation or per-column, please modify * nspname, relname, and attname in 'WHERE' clause. @@ -139,7 +141,7 @@ TO STDOUT (FORMAT 'binary'); \o COMMIT; -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+------------------------+-------------+-------------+-------------+-------------+------------------------+------------+------------+------------+------------ @@ -174,8 +176,8 @@ SELECT * FROM work_v; TRUNCATE dbms_stats.work; -- No.16-1-2 -\! sed '/ORDER/i\\ AND n2.nspname = '"\'s0\'" doc/export_plain_stats-14.sql.sample > doc/export_plain_stats-14.sql.sample_test -\i doc/export_plain_stats-14.sql.sample_test +\! sed '/ORDER/i\\ AND n2.nspname = '"\'s0\'" doc/export_plain_stats-15.sql.sample > doc/export_plain_stats-15.sql.sample_test +\i doc/export_plain_stats-15.sql.sample_test /* * If you want the statistics of per-relation or per-column, please modify * nspname, relname, and attname in 'WHERE' clause. @@ -255,7 +257,7 @@ TO STDOUT (FORMAT 'binary'); \o COMMIT; -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+------------------------+------------+------------+------------+------------ @@ -278,10 +280,10 @@ SELECT * FROM work_v; (16 rows) TRUNCATE dbms_stats.work; -\! rm doc/export_plain_stats-14.sql.sample_test +\! rm doc/export_plain_stats-15.sql.sample_test -- No.16-1-3 -\! sed '/ORDER/i\\ AND c.relname = '"\'st0\'" doc/export_plain_stats-14.sql.sample > doc/export_plain_stats-14.sql.sample_test -\i doc/export_plain_stats-14.sql.sample_test +\! sed '/ORDER/i\\ AND c.relname = '"\'st0\'" doc/export_plain_stats-15.sql.sample > doc/export_plain_stats-15.sql.sample_test +\i doc/export_plain_stats-15.sql.sample_test /* * If you want the statistics of per-relation or per-column, please modify * nspname, relname, and attname in 'WHERE' clause. @@ -361,7 +363,7 @@ TO STDOUT (FORMAT 'binary'); \o COMMIT; -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+------------------+------------+------------+------------+------------ @@ -376,17 +378,17 @@ SELECT * FROM work_v; (8 rows) TRUNCATE dbms_stats.work; -\! rm doc/export_plain_stats-14.sql.sample_test +\! rm doc/export_plain_stats-15.sql.sample_test -- No.16-1-3-1 Actual import test -select dbms_stats.import_database_stats('/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp'); +select dbms_stats.import_database_stats(:'dump_path'); import_database_stats ----------------------- (1 row) -- No.16-1-4 -\! sed '/ORDER/i\\ AND c.relname = '"\'pg_toast_1262\'" doc/export_plain_stats-14.sql.sample > doc/export_plain_stats-14.sql.sample_test -\i doc/export_plain_stats-14.sql.sample_test +\! sed '/ORDER/i\\ AND c.relname = '"\'pg_toast_1262\'" doc/export_plain_stats-15.sql.sample > doc/export_plain_stats-15.sql.sample_test +\i doc/export_plain_stats-15.sql.sample_test /* * If you want the statistics of per-relation or per-column, please modify * nspname, relname, and attname in 'WHERE' clause. @@ -466,17 +468,17 @@ TO STDOUT (FORMAT 'binary'); \o COMMIT; -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------ (0 rows) TRUNCATE dbms_stats.work; -\! rm doc/export_plain_stats-14.sql.sample_test +\! rm doc/export_plain_stats-15.sql.sample_test -- No.16-1-5 -\! sed '/ORDER/i\\ AND c.relname = '"\'st0_idx\'" doc/export_plain_stats-14.sql.sample > doc/export_plain_stats-14.sql.sample_test -\i doc/export_plain_stats-14.sql.sample_test +\! sed '/ORDER/i\\ AND c.relname = '"\'st0_idx\'" doc/export_plain_stats-15.sql.sample > doc/export_plain_stats-15.sql.sample_test +\i doc/export_plain_stats-15.sql.sample_test /* * If you want the statistics of per-relation or per-column, please modify * nspname, relname, and attname in 'WHERE' clause. @@ -556,7 +558,7 @@ TO STDOUT (FORMAT 'binary'); \o COMMIT; -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------ @@ -565,10 +567,10 @@ SELECT * FROM work_v; (2 rows) TRUNCATE dbms_stats.work; -\! rm doc/export_plain_stats-14.sql.sample_test +\! rm doc/export_plain_stats-15.sql.sample_test -- No.16-1-6 -\! sed '/ORDER/i\\ AND c.relname = '"\'ss0\'" doc/export_plain_stats-14.sql.sample > doc/export_plain_stats-14.sql.sample_test -\i doc/export_plain_stats-14.sql.sample_test +\! sed '/ORDER/i\\ AND c.relname = '"\'ss0\'" doc/export_plain_stats-15.sql.sample > doc/export_plain_stats-15.sql.sample_test +\i doc/export_plain_stats-15.sql.sample_test /* * If you want the statistics of per-relation or per-column, please modify * nspname, relname, and attname in 'WHERE' clause. @@ -648,17 +650,17 @@ TO STDOUT (FORMAT 'binary'); \o COMMIT; -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------ (0 rows) TRUNCATE dbms_stats.work; -\! rm doc/export_plain_stats-14.sql.sample_test +\! rm doc/export_plain_stats-15.sql.sample_test -- No.16-1-7 -\! sed '/ORDER/i\\ AND c.relname = '"\'sc0\'" doc/export_plain_stats-14.sql.sample > doc/export_plain_stats-14.sql.sample_test -\i doc/export_plain_stats-14.sql.sample_test +\! sed '/ORDER/i\\ AND c.relname = '"\'sc0\'" doc/export_plain_stats-15.sql.sample > doc/export_plain_stats-15.sql.sample_test +\i doc/export_plain_stats-15.sql.sample_test /* * If you want the statistics of per-relation or per-column, please modify * nspname, relname, and attname in 'WHERE' clause. @@ -738,17 +740,17 @@ TO STDOUT (FORMAT 'binary'); \o COMMIT; -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------ (0 rows) TRUNCATE dbms_stats.work; -\! rm doc/export_plain_stats-14.sql.sample_test +\! rm doc/export_plain_stats-15.sql.sample_test -- No.16-1-8 -\! sed '/ORDER/i\\ AND c.relname = '"\'sft0\'" doc/export_plain_stats-14.sql.sample > doc/export_plain_stats-14.sql.sample_test -\i doc/export_plain_stats-14.sql.sample_test +\! sed '/ORDER/i\\ AND c.relname = '"\'sft0\'" doc/export_plain_stats-15.sql.sample > doc/export_plain_stats-15.sql.sample_test +\i doc/export_plain_stats-15.sql.sample_test /* * If you want the statistics of per-relation or per-column, please modify * nspname, relname, and attname in 'WHERE' clause. @@ -828,7 +830,7 @@ TO STDOUT (FORMAT 'binary'); \o COMMIT; -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+------------------------+------------+------------+------------+------------ @@ -836,10 +838,10 @@ SELECT * FROM work_v; (1 row) TRUNCATE dbms_stats.work; -\! rm doc/export_plain_stats-14.sql.sample_test +\! rm doc/export_plain_stats-15.sql.sample_test -- No.16-1-9 -\! sed '/ORDER/i\\ AND c.relname = '"\'smv0\'" doc/export_plain_stats-14.sql.sample > doc/export_plain_stats-14.sql.sample_test -\i doc/export_plain_stats-14.sql.sample_test +\! sed '/ORDER/i\\ AND c.relname = '"\'smv0\'" doc/export_plain_stats-15.sql.sample > doc/export_plain_stats-15.sql.sample_test +\i doc/export_plain_stats-15.sql.sample_test /* * If you want the statistics of per-relation or per-column, please modify * nspname, relname, and attname in 'WHERE' clause. @@ -919,7 +921,7 @@ TO STDOUT (FORMAT 'binary'); \o COMMIT; -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------ @@ -929,10 +931,10 @@ SELECT * FROM work_v; (3 rows) TRUNCATE dbms_stats.work; -\! rm doc/export_plain_stats-14.sql.sample_test +\! rm doc/export_plain_stats-15.sql.sample_test -- No.16-1-10 -\! sed '/ORDER/i\\ AND n2.nspname = '"\'s0\'"' AND a.attname = '\'id\' doc/export_plain_stats-14.sql.sample > doc/export_plain_stats-14.sql.sample_test -\i doc/export_plain_stats-14.sql.sample_test +\! sed '/ORDER/i\\ AND n2.nspname = '"\'s0\'"' AND a.attname = '\'id\' doc/export_plain_stats-15.sql.sample > doc/export_plain_stats-15.sql.sample_test +\i doc/export_plain_stats-15.sql.sample_test /* * If you want the statistics of per-relation or per-column, please modify * nspname, relname, and attname in 'WHERE' clause. @@ -1012,7 +1014,7 @@ TO STDOUT (FORMAT 'binary'); \o COMMIT; -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+------------------------+------------+------------+------------+------------ @@ -1025,10 +1027,10 @@ SELECT * FROM work_v; (6 rows) TRUNCATE dbms_stats.work; -\! rm doc/export_plain_stats-14.sql.sample_test +\! rm doc/export_plain_stats-15.sql.sample_test -- No.16-1-11 -\! sed '/ORDER/i\\ AND n2.nspname = '"\'s0\'"' AND a.attname IS NULL' doc/export_plain_stats-14.sql.sample > doc/export_plain_stats-14.sql.sample_test -\i doc/export_plain_stats-14.sql.sample_test +\! sed '/ORDER/i\\ AND n2.nspname = '"\'s0\'"' AND a.attname IS NULL' doc/export_plain_stats-15.sql.sample > doc/export_plain_stats-15.sql.sample_test +\i doc/export_plain_stats-15.sql.sample_test /* * If you want the statistics of per-relation or per-column, please modify * nspname, relname, and attname in 'WHERE' clause. @@ -1108,7 +1110,7 @@ TO STDOUT (FORMAT 'binary'); \o COMMIT; -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------ @@ -1119,10 +1121,10 @@ SELECT * FROM work_v; (4 rows) TRUNCATE dbms_stats.work; -\! rm doc/export_plain_stats-14.sql.sample_test +\! rm doc/export_plain_stats-15.sql.sample_test -- No.16-1-12 -\! sed '/ORDER/i\\ AND n2.nspname = '"\'s1\'"' AND c.relname IS NULL' doc/export_plain_stats-14.sql.sample > doc/export_plain_stats-14.sql.sample_test -\i doc/export_plain_stats-14.sql.sample_test +\! sed '/ORDER/i\\ AND n2.nspname = '"\'s1\'"' AND c.relname IS NULL' doc/export_plain_stats-15.sql.sample > doc/export_plain_stats-15.sql.sample_test +\i doc/export_plain_stats-15.sql.sample_test /* * If you want the statistics of per-relation or per-column, please modify * nspname, relname, and attname in 'WHERE' clause. @@ -1202,16 +1204,16 @@ TO STDOUT (FORMAT 'binary'); \o COMMIT; -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------ (0 rows) TRUNCATE dbms_stats.work; -\! rm doc/export_plain_stats-14.sql.sample_test +\! rm doc/export_plain_stats-15.sql.sample_test /* - * No.16-2 export_effective_stats-14.sql.sample + * No.16-2 export_effective_stats-15.sql.sample */ -- No.16-2-1 VACUUM ANALYZE; @@ -1253,7 +1255,7 @@ UPDATE dbms_stats.column_stats_locked NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) WHERE starelid = 's0.st0'::regclass; -\i doc/export_effective_stats-14.sql.sample +\i doc/export_effective_stats-15.sql.sample /* * If you want the statistics of per-relation or per-column, please modify * nspname, relname, and attname in 'WHERE' clause. @@ -1325,7 +1327,7 @@ TO STDOUT (FORMAT 'binary'); \o COMMIT; -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+------------------+------------+------------------------+------------+------------ @@ -1360,8 +1362,8 @@ SELECT * FROM work_v; TRUNCATE dbms_stats.work; -- No.16-2-2 -\! sed '/ORDER/i\\ WHERE n2.nspname = '"\'s0\'" doc/export_effective_stats-14.sql.sample > doc/export_effective_stats-14.sql.sample_test -\i doc/export_effective_stats-14.sql.sample_test +\! sed '/ORDER/i\\ WHERE n2.nspname = '"\'s0\'" doc/export_effective_stats-15.sql.sample > doc/export_effective_stats-15.sql.sample_test +\i doc/export_effective_stats-15.sql.sample_test /* * If you want the statistics of per-relation or per-column, please modify * nspname, relname, and attname in 'WHERE' clause. @@ -1434,7 +1436,7 @@ TO STDOUT (FORMAT 'binary'); \o COMMIT; -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+------------------+------------+------------------------+------------+------------ @@ -1456,11 +1458,11 @@ SELECT * FROM work_v; s0 | st3 | 0 | 0 | 0 | 0 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) (16 rows) -\! rm doc/export_effective_stats-14.sql.sample_test +\! rm doc/export_effective_stats-15.sql.sample_test TRUNCATE dbms_stats.work; -- No.16-2-3 -\! sed '/ORDER/i\\ WHERE cl.relname = '"\'st0\'" doc/export_effective_stats-14.sql.sample > doc/export_effective_stats-14.sql.sample_test -\i doc/export_effective_stats-14.sql.sample_test +\! sed '/ORDER/i\\ WHERE cl.relname = '"\'st0\'" doc/export_effective_stats-15.sql.sample > doc/export_effective_stats-15.sql.sample_test +\i doc/export_effective_stats-15.sql.sample_test /* * If you want the statistics of per-relation or per-column, please modify * nspname, relname, and attname in 'WHERE' clause. @@ -1533,7 +1535,7 @@ TO STDOUT (FORMAT 'binary'); \o COMMIT; -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+------------------+------------+------------+------------+------------ @@ -1547,11 +1549,11 @@ SELECT * FROM work_v; s1 | st0 | 1 | 4 | 1 | 1 | num | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {15,25,35,45} | (null) | (null) | (null) | (null) (8 rows) -\! rm doc/export_effective_stats-14.sql.sample_test +\! rm doc/export_effective_stats-15.sql.sample_test TRUNCATE dbms_stats.work; -- No.16-2-4 -\! sed '/ORDER/i\\ WHERE cl.relname = '"\'pg_toast_1262\'" doc/export_effective_stats-14.sql.sample > doc/export_effective_stats-14.sql.sample_test -\i doc/export_effective_stats-14.sql.sample_test +\! sed '/ORDER/i\\ WHERE cl.relname = '"\'pg_toast_1262\'" doc/export_effective_stats-15.sql.sample > doc/export_effective_stats-15.sql.sample_test +\i doc/export_effective_stats-15.sql.sample_test /* * If you want the statistics of per-relation or per-column, please modify * nspname, relname, and attname in 'WHERE' clause. @@ -1624,17 +1626,17 @@ TO STDOUT (FORMAT 'binary'); \o COMMIT; -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------ (0 rows) -\! rm doc/export_effective_stats-14.sql.sample_test +\! rm doc/export_effective_stats-15.sql.sample_test TRUNCATE dbms_stats.work; -- No.16-2-5 -\! sed '/ORDER/i\\ WHERE cl.relname = '"\'st0_idx\'" doc/export_effective_stats-14.sql.sample > doc/export_effective_stats-14.sql.sample_test -\i doc/export_effective_stats-14.sql.sample_test +\! sed '/ORDER/i\\ WHERE cl.relname = '"\'st0_idx\'" doc/export_effective_stats-15.sql.sample > doc/export_effective_stats-15.sql.sample_test +\i doc/export_effective_stats-15.sql.sample_test /* * If you want the statistics of per-relation or per-column, please modify * nspname, relname, and attname in 'WHERE' clause. @@ -1707,7 +1709,7 @@ TO STDOUT (FORMAT 'binary'); \o COMMIT; -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------ @@ -1715,11 +1717,11 @@ SELECT * FROM work_v; s0 | st0_idx | 2 | 2 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) (2 rows) -\! rm doc/export_effective_stats-14.sql.sample_test +\! rm doc/export_effective_stats-15.sql.sample_test TRUNCATE dbms_stats.work; -- No.16-2-6 -\! sed '/ORDER/i\\ WHERE cl.relname = '"\'ss0\'" doc/export_effective_stats-14.sql.sample > doc/export_effective_stats-14.sql.sample_test -\i doc/export_effective_stats-14.sql.sample_test +\! sed '/ORDER/i\\ WHERE cl.relname = '"\'ss0\'" doc/export_effective_stats-15.sql.sample > doc/export_effective_stats-15.sql.sample_test +\i doc/export_effective_stats-15.sql.sample_test /* * If you want the statistics of per-relation or per-column, please modify * nspname, relname, and attname in 'WHERE' clause. @@ -1792,17 +1794,17 @@ TO STDOUT (FORMAT 'binary'); \o COMMIT; -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------ (0 rows) -\! rm doc/export_effective_stats-14.sql.sample_test +\! rm doc/export_effective_stats-15.sql.sample_test TRUNCATE dbms_stats.work; -- No.16-2-7 -\! sed '/ORDER/i\\ WHERE cl.relname = '"\'sc0\'" doc/export_effective_stats-14.sql.sample > doc/export_effective_stats-14.sql.sample_test -\i doc/export_effective_stats-14.sql.sample_test +\! sed '/ORDER/i\\ WHERE cl.relname = '"\'sc0\'" doc/export_effective_stats-15.sql.sample > doc/export_effective_stats-15.sql.sample_test +\i doc/export_effective_stats-15.sql.sample_test /* * If you want the statistics of per-relation or per-column, please modify * nspname, relname, and attname in 'WHERE' clause. @@ -1875,17 +1877,17 @@ TO STDOUT (FORMAT 'binary'); \o COMMIT; -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------ (0 rows) -\! rm doc/export_effective_stats-14.sql.sample_test +\! rm doc/export_effective_stats-15.sql.sample_test TRUNCATE dbms_stats.work; -- No.16-2-8 -\! sed '/ORDER/i\\ WHERE cl.relname = '"\'sft0\'" doc/export_effective_stats-14.sql.sample > doc/export_effective_stats-14.sql.sample_test -\i doc/export_effective_stats-14.sql.sample_test +\! sed '/ORDER/i\\ WHERE cl.relname = '"\'sft0\'" doc/export_effective_stats-15.sql.sample > doc/export_effective_stats-15.sql.sample_test +\i doc/export_effective_stats-15.sql.sample_test /* * If you want the statistics of per-relation or per-column, please modify * nspname, relname, and attname in 'WHERE' clause. @@ -1958,18 +1960,18 @@ TO STDOUT (FORMAT 'binary'); \o COMMIT; -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------------------+------------+------------ s0 | sft0 | 1 | 10 | 0 | 0 | id | pg_catalog | int4 | -1 | f | -1 | -1 | -1 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | 32 | 33 | 34 | 31 | 35 | {-1,22} | {-1,23} | {-1,24} | {-1,21} | {-1,25} | (null) | (null) | {1,2,3,4,5,6,7,8,9,10} | (null) | (null) (1 row) -\! rm doc/export_effective_stats-14.sql.sample_test +\! rm doc/export_effective_stats-15.sql.sample_test TRUNCATE dbms_stats.work; -- No.16-2-9 -\! sed '/ORDER/i\\ WHERE cl.relname = '"\'smv0\'" doc/export_effective_stats-14.sql.sample > doc/export_effective_stats-14.sql.sample_test -\i doc/export_effective_stats-14.sql.sample_test +\! sed '/ORDER/i\\ WHERE cl.relname = '"\'smv0\'" doc/export_effective_stats-15.sql.sample > doc/export_effective_stats-15.sql.sample_test +\i doc/export_effective_stats-15.sql.sample_test /* * If you want the statistics of per-relation or per-column, please modify * nspname, relname, and attname in 'WHERE' clause. @@ -2042,7 +2044,7 @@ TO STDOUT (FORMAT 'binary'); \o COMMIT; -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------ @@ -2051,11 +2053,11 @@ SELECT * FROM work_v; s0 | smv0 | 1 | 2 | 1 | 1 | txt | pg_catalog | text | -1 | f | -3 | -3 | -3 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | 32 | 33 | 34 | 31 | 35 | {-3,22} | {-3,23} | {-3,24} | {-3,21} | {-3,25} | (null) | (null) | {1,test} | (null) | (null) (3 rows) -\! rm doc/export_effective_stats-14.sql.sample_test +\! rm doc/export_effective_stats-15.sql.sample_test TRUNCATE dbms_stats.work; -- No.16-2-10 -\! sed '/ORDER/i\\ WHERE n2.nspname = '"\'s0\'"' AND a.attname = '"\'id\'" doc/export_effective_stats-14.sql.sample > doc/export_effective_stats-14.sql.sample_test -\i doc/export_effective_stats-14.sql.sample_test +\! sed '/ORDER/i\\ WHERE n2.nspname = '"\'s0\'"' AND a.attname = '"\'id\'" doc/export_effective_stats-15.sql.sample > doc/export_effective_stats-15.sql.sample_test +\i doc/export_effective_stats-15.sql.sample_test /* * If you want the statistics of per-relation or per-column, please modify * nspname, relname, and attname in 'WHERE' clause. @@ -2128,7 +2130,7 @@ TO STDOUT (FORMAT 'binary'); \o COMMIT; -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+-------------+------------+------------------------+------------+------------ @@ -2140,11 +2142,11 @@ SELECT * FROM work_v; s0 | st2 | 1 | 3 | 1 | 1 | id | pg_catalog | int4 | -1 | f | -1 | -1 | -1 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | 32 | 33 | 34 | 31 | 35 | {-1,22} | {-1,23} | {-1,24} | {-1,21} | {-1,25} | (null) | (null) | {1,2,3} | (null) | (null) (6 rows) -\! rm doc/export_effective_stats-14.sql.sample_test +\! rm doc/export_effective_stats-15.sql.sample_test TRUNCATE dbms_stats.work; -- No.16-2-11 -\! sed '/ORDER/i\\ WHERE n2.nspname = '"\'s0\'"' AND a.attname IS NULL' doc/export_effective_stats-14.sql.sample > doc/export_effective_stats-14.sql.sample_test -\i doc/export_effective_stats-14.sql.sample_test +\! sed '/ORDER/i\\ WHERE n2.nspname = '"\'s0\'"' AND a.attname IS NULL' doc/export_effective_stats-15.sql.sample > doc/export_effective_stats-15.sql.sample_test +\i doc/export_effective_stats-15.sql.sample_test /* * If you want the statistics of per-relation or per-column, please modify * nspname, relname, and attname in 'WHERE' clause. @@ -2217,7 +2219,7 @@ TO STDOUT (FORMAT 'binary'); \o COMMIT; -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------ @@ -2227,11 +2229,11 @@ SELECT * FROM work_v; s0 | st3 | 0 | 0 | 0 | 0 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) (4 rows) -\! rm doc/export_effective_stats-14.sql.sample_test +\! rm doc/export_effective_stats-15.sql.sample_test TRUNCATE dbms_stats.work; -- No.16-2-12 -\! sed '/ORDER/i\\ WHERE n2.nspname = '"\'s0\'"' AND cl.relname IS NULL' doc/export_effective_stats-14.sql.sample > doc/export_effective_stats-14.sql.sample_test -\i doc/export_effective_stats-14.sql.sample_test +\! sed '/ORDER/i\\ WHERE n2.nspname = '"\'s0\'"' AND cl.relname IS NULL' doc/export_effective_stats-15.sql.sample > doc/export_effective_stats-15.sql.sample_test +\i doc/export_effective_stats-15.sql.sample_test /* * If you want the statistics of per-relation or per-column, please modify * nspname, relname, and attname in 'WHERE' clause. @@ -2304,13 +2306,13 @@ TO STDOUT (FORMAT 'binary'); \o COMMIT; -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------ (0 rows) -\! rm doc/export_effective_stats-14.sql.sample_test +\! rm doc/export_effective_stats-15.sql.sample_test TRUNCATE dbms_stats.work; /* * Stab function dbms_stats.import @@ -2338,8 +2340,8 @@ LANGUAGE plpgsql; * No.17-1 dbms_stats.import_database_stats(src) */ -- No.17-1-1 -SELECT dbms_stats.import_database_stats('/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp'); -NOTICE: arguments are "", "", "", "/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp" +SELECT dbms_stats.import_database_stats('export_stats.dmp'); +NOTICE: arguments are "", "", "", "export_stats.dmp" import_database_stats ----------------------- @@ -2349,8 +2351,8 @@ NOTICE: arguments are "", "", "", "/home/postgres/git_repos/i * No.17-2 dbms_stats.import_schema_stats(schemaname, src) */ -- No.17-2-1 -SELECT dbms_stats.import_schema_stats('s0', '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp'); -NOTICE: arguments are "s0", "", "", "/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp" +SELECT dbms_stats.import_schema_stats('s0', 'export_stats.dmp'); +NOTICE: arguments are "s0", "", "", "export_stats.dmp" import_schema_stats --------------------- @@ -2360,8 +2362,8 @@ NOTICE: arguments are "s0", "", "", "/home/postgres/git_repos/inter * No.17-3 dbms_stats.import_table_stats(relid, src) */ -- No.17-3-1 -SELECT dbms_stats.import_table_stats('s0.st0', '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp'); -NOTICE: arguments are "", "s0.st0", "", "/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp" +SELECT dbms_stats.import_table_stats('s0.st0', 'export_stats.dmp'); +NOTICE: arguments are "", "s0.st0", "", "export_stats.dmp" import_table_stats -------------------- @@ -2371,8 +2373,8 @@ NOTICE: arguments are "", "s0.st0", "", "/home/postgres/git_repos/i * No.17-4 dbms_stats.import_table_stats(schemaname, tablename, src) */ -- No.17-4-1 -SELECT dbms_stats.import_table_stats('s0', 'st0', '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp'); -NOTICE: arguments are "", "s0.st0", "", "/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp" +SELECT dbms_stats.import_table_stats('s0', 'st0', 'export_stats.dmp'); +NOTICE: arguments are "", "s0.st0", "", "export_stats.dmp" import_table_stats -------------------- @@ -2382,8 +2384,8 @@ NOTICE: arguments are "", "s0.st0", "", "/home/postgres/git_repos/i * No.17-5 dbms_stats.import_column_stats (relid, attname, src) */ -- No.17-5-1 -SELECT dbms_stats.import_column_stats('s0.st0', 'id', '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp'); -NOTICE: arguments are "", "s0.st0", "id", "/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp" +SELECT dbms_stats.import_column_stats('s0.st0', 'id', 'export_stats.dmp'); +NOTICE: arguments are "", "s0.st0", "id", "export_stats.dmp" import_column_stats --------------------- @@ -2393,8 +2395,8 @@ NOTICE: arguments are "", "s0.st0", "id", "/home/postgres/git_repos/inter * No.17-6 dbms_stats.import_column_stats (schemaname, tablename, attname, src) */ -- No.17-6-1 -SELECT dbms_stats.import_column_stats('s0', 'st0', 'id','/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp'); -NOTICE: arguments are "", "s0.st0", "id", "/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp" +SELECT dbms_stats.import_column_stats('s0', 'st0', 'id', 'export_stats.dmp'); +NOTICE: arguments are "", "s0.st0", "id", "export_stats.dmp" import_column_stats --------------------- diff --git a/input/ut_imp_exp.source b/input/ut_imp_exp.source deleted file mode 100644 index 6269b3f..0000000 --- a/input/ut_imp_exp.source +++ /dev/null @@ -1,302 +0,0 @@ -\pset null '(null)' -CREATE TABLE s0.st3(); -/* - * No.16-1 export_plain_stats-14.sql.sample - */ --- No.16-1-1 -ANALYZE; -DELETE FROM dbms_stats.column_stats_locked; -DELETE FROM dbms_stats.relation_stats_locked; -SELECT dbms_stats.lock_database_stats(); -UPDATE dbms_stats.relation_stats_locked - SET (relpages, reltuples, relallvisible, curpages) = (0,0,0,0); -UPDATE dbms_stats.column_stats_locked SET - stanullfrac = -staattnum, - stawidth = -staattnum, - stadistinct = -staattnum, - stakind1 = 2, - stakind2 = 3, - stakind3 = 4, - stakind4 = 1, - stakind5 = 5, - staop1 = 22, - staop2 = 23, - staop3 = 24, - staop4 = 21, - staop5 = 25, - stacoll1 = 32, - stacoll2 = 33, - stacoll3 = 34, - stacoll4 = 31, - stacoll5 = 35, - stanumbers1 = ARRAY[-staattnum,22], - stanumbers2 = ARRAY[-staattnum,23], - stanumbers3 = ARRAY[-staattnum,24], - stanumbers4 = ARRAY[-staattnum,21], - stanumbers5 = ARRAY[-staattnum,25], - stavalues1 = stavalues3, - stavalues2 = stavalues2, - stavalues3 = stavalues1, - stavalues4 = stavalues4, - stavalues5 = stavalues5; -\i doc/export_plain_stats-14.sql.sample -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; -TRUNCATE dbms_stats.work; --- No.16-1-2 -\! sed '/ORDER/i\\ AND n2.nspname = '"\'s0\'" doc/export_plain_stats-14.sql.sample > doc/export_plain_stats-14.sql.sample_test -\i doc/export_plain_stats-14.sql.sample_test -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; -TRUNCATE dbms_stats.work; -\! rm doc/export_plain_stats-14.sql.sample_test --- No.16-1-3 -\! sed '/ORDER/i\\ AND c.relname = '"\'st0\'" doc/export_plain_stats-14.sql.sample > doc/export_plain_stats-14.sql.sample_test -\i doc/export_plain_stats-14.sql.sample_test -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; -TRUNCATE dbms_stats.work; -\! rm doc/export_plain_stats-14.sql.sample_test --- No.16-1-3-1 Actual import test -select dbms_stats.import_database_stats('@abs_srcdir@/export_stats.dmp'); --- No.16-1-4 -\! sed '/ORDER/i\\ AND c.relname = '"\'pg_toast_1262\'" doc/export_plain_stats-14.sql.sample > doc/export_plain_stats-14.sql.sample_test -\i doc/export_plain_stats-14.sql.sample_test -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; -TRUNCATE dbms_stats.work; -\! rm doc/export_plain_stats-14.sql.sample_test --- No.16-1-5 -\! sed '/ORDER/i\\ AND c.relname = '"\'st0_idx\'" doc/export_plain_stats-14.sql.sample > doc/export_plain_stats-14.sql.sample_test -\i doc/export_plain_stats-14.sql.sample_test -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; -TRUNCATE dbms_stats.work; -\! rm doc/export_plain_stats-14.sql.sample_test --- No.16-1-6 -\! sed '/ORDER/i\\ AND c.relname = '"\'ss0\'" doc/export_plain_stats-14.sql.sample > doc/export_plain_stats-14.sql.sample_test -\i doc/export_plain_stats-14.sql.sample_test -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; -TRUNCATE dbms_stats.work; -\! rm doc/export_plain_stats-14.sql.sample_test --- No.16-1-7 -\! sed '/ORDER/i\\ AND c.relname = '"\'sc0\'" doc/export_plain_stats-14.sql.sample > doc/export_plain_stats-14.sql.sample_test -\i doc/export_plain_stats-14.sql.sample_test -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; -TRUNCATE dbms_stats.work; -\! rm doc/export_plain_stats-14.sql.sample_test --- No.16-1-8 -\! sed '/ORDER/i\\ AND c.relname = '"\'sft0\'" doc/export_plain_stats-14.sql.sample > doc/export_plain_stats-14.sql.sample_test -\i doc/export_plain_stats-14.sql.sample_test -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; -TRUNCATE dbms_stats.work; -\! rm doc/export_plain_stats-14.sql.sample_test --- No.16-1-9 -\! sed '/ORDER/i\\ AND c.relname = '"\'smv0\'" doc/export_plain_stats-14.sql.sample > doc/export_plain_stats-14.sql.sample_test -\i doc/export_plain_stats-14.sql.sample_test -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; -TRUNCATE dbms_stats.work; -\! rm doc/export_plain_stats-14.sql.sample_test --- No.16-1-10 -\! sed '/ORDER/i\\ AND n2.nspname = '"\'s0\'"' AND a.attname = '\'id\' doc/export_plain_stats-14.sql.sample > doc/export_plain_stats-14.sql.sample_test -\i doc/export_plain_stats-14.sql.sample_test -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; -TRUNCATE dbms_stats.work; -\! rm doc/export_plain_stats-14.sql.sample_test --- No.16-1-11 -\! sed '/ORDER/i\\ AND n2.nspname = '"\'s0\'"' AND a.attname IS NULL' doc/export_plain_stats-14.sql.sample > doc/export_plain_stats-14.sql.sample_test -\i doc/export_plain_stats-14.sql.sample_test -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; -TRUNCATE dbms_stats.work; -\! rm doc/export_plain_stats-14.sql.sample_test --- No.16-1-12 -\! sed '/ORDER/i\\ AND n2.nspname = '"\'s1\'"' AND c.relname IS NULL' doc/export_plain_stats-14.sql.sample > doc/export_plain_stats-14.sql.sample_test -\i doc/export_plain_stats-14.sql.sample_test -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; -TRUNCATE dbms_stats.work; -\! rm doc/export_plain_stats-14.sql.sample_test - -/* - * No.16-2 export_effective_stats-14.sql.sample - */ --- No.16-2-1 -VACUUM ANALYZE; -SELECT dbms_stats.lock_database_stats(); -UPDATE dbms_stats.relation_stats_locked - SET (relpages, reltuples, relallvisible, curpages) = (NULL, NULL, NULL, NULL); -UPDATE dbms_stats.column_stats_locked - SET (stanullfrac, stawidth, stadistinct, - stakind1, stakind2, stakind3, stakind4, stakind5, - staop1, staop2, staop3, staop4, staop5, - stacoll1, stacoll2, stacoll3, stacoll4, stacoll5, - stanumbers1, stanumbers2, stanumbers3, stanumbers4, stanumbers5, - stavalues1, stavalues2, stavalues3, stavalues4, stavalues5) - = (NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL) - WHERE starelid = 's0.st0'::regclass; -\i doc/export_effective_stats-14.sql.sample -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; -TRUNCATE dbms_stats.work; --- No.16-2-2 -\! sed '/ORDER/i\\ WHERE n2.nspname = '"\'s0\'" doc/export_effective_stats-14.sql.sample > doc/export_effective_stats-14.sql.sample_test -\i doc/export_effective_stats-14.sql.sample_test -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; -\! rm doc/export_effective_stats-14.sql.sample_test -TRUNCATE dbms_stats.work; --- No.16-2-3 -\! sed '/ORDER/i\\ WHERE cl.relname = '"\'st0\'" doc/export_effective_stats-14.sql.sample > doc/export_effective_stats-14.sql.sample_test -\i doc/export_effective_stats-14.sql.sample_test -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; -\! rm doc/export_effective_stats-14.sql.sample_test -TRUNCATE dbms_stats.work; --- No.16-2-4 -\! sed '/ORDER/i\\ WHERE cl.relname = '"\'pg_toast_1262\'" doc/export_effective_stats-14.sql.sample > doc/export_effective_stats-14.sql.sample_test -\i doc/export_effective_stats-14.sql.sample_test -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; -\! rm doc/export_effective_stats-14.sql.sample_test -TRUNCATE dbms_stats.work; --- No.16-2-5 -\! sed '/ORDER/i\\ WHERE cl.relname = '"\'st0_idx\'" doc/export_effective_stats-14.sql.sample > doc/export_effective_stats-14.sql.sample_test -\i doc/export_effective_stats-14.sql.sample_test -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; -\! rm doc/export_effective_stats-14.sql.sample_test -TRUNCATE dbms_stats.work; --- No.16-2-6 -\! sed '/ORDER/i\\ WHERE cl.relname = '"\'ss0\'" doc/export_effective_stats-14.sql.sample > doc/export_effective_stats-14.sql.sample_test -\i doc/export_effective_stats-14.sql.sample_test -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; -\! rm doc/export_effective_stats-14.sql.sample_test -TRUNCATE dbms_stats.work; --- No.16-2-7 -\! sed '/ORDER/i\\ WHERE cl.relname = '"\'sc0\'" doc/export_effective_stats-14.sql.sample > doc/export_effective_stats-14.sql.sample_test -\i doc/export_effective_stats-14.sql.sample_test -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; -\! rm doc/export_effective_stats-14.sql.sample_test -TRUNCATE dbms_stats.work; --- No.16-2-8 -\! sed '/ORDER/i\\ WHERE cl.relname = '"\'sft0\'" doc/export_effective_stats-14.sql.sample > doc/export_effective_stats-14.sql.sample_test -\i doc/export_effective_stats-14.sql.sample_test -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; -\! rm doc/export_effective_stats-14.sql.sample_test -TRUNCATE dbms_stats.work; --- No.16-2-9 -\! sed '/ORDER/i\\ WHERE cl.relname = '"\'smv0\'" doc/export_effective_stats-14.sql.sample > doc/export_effective_stats-14.sql.sample_test -\i doc/export_effective_stats-14.sql.sample_test -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; -\! rm doc/export_effective_stats-14.sql.sample_test -TRUNCATE dbms_stats.work; --- No.16-2-10 -\! sed '/ORDER/i\\ WHERE n2.nspname = '"\'s0\'"' AND a.attname = '"\'id\'" doc/export_effective_stats-14.sql.sample > doc/export_effective_stats-14.sql.sample_test -\i doc/export_effective_stats-14.sql.sample_test -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; -\! rm doc/export_effective_stats-14.sql.sample_test -TRUNCATE dbms_stats.work; --- No.16-2-11 -\! sed '/ORDER/i\\ WHERE n2.nspname = '"\'s0\'"' AND a.attname IS NULL' doc/export_effective_stats-14.sql.sample > doc/export_effective_stats-14.sql.sample_test -\i doc/export_effective_stats-14.sql.sample_test -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; -\! rm doc/export_effective_stats-14.sql.sample_test -TRUNCATE dbms_stats.work; --- No.16-2-12 -\! sed '/ORDER/i\\ WHERE n2.nspname = '"\'s0\'"' AND cl.relname IS NULL' doc/export_effective_stats-14.sql.sample > doc/export_effective_stats-14.sql.sample_test -\i doc/export_effective_stats-14.sql.sample_test -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; -\! rm doc/export_effective_stats-14.sql.sample_test -TRUNCATE dbms_stats.work; - -/* - * Stab function dbms_stats.import - */ -ALTER FUNCTION dbms_stats.import( - nspname text, - relid regclass, - attname text, - src text -) RENAME TO truth_import; -CREATE FUNCTION dbms_stats.import( - nspname text, - relid regclass, - attname text, - src text -) RETURNS void AS -$$ -BEGIN - RAISE NOTICE 'arguments are "%", "%", "%", "%"', $1, $2, $3, $4; - RETURN; -END -$$ -LANGUAGE plpgsql; -/* - * No.17-1 dbms_stats.import_database_stats(src) - */ --- No.17-1-1 -SELECT dbms_stats.import_database_stats('@abs_srcdir@/export_stats.dmp'); - -/* - * No.17-2 dbms_stats.import_schema_stats(schemaname, src) - */ --- No.17-2-1 -SELECT dbms_stats.import_schema_stats('s0', '@abs_srcdir@/export_stats.dmp'); - -/* - * No.17-3 dbms_stats.import_table_stats(relid, src) - */ --- No.17-3-1 -SELECT dbms_stats.import_table_stats('s0.st0', '@abs_srcdir@/export_stats.dmp'); - -/* - * No.17-4 dbms_stats.import_table_stats(schemaname, tablename, src) - */ --- No.17-4-1 -SELECT dbms_stats.import_table_stats('s0', 'st0', '@abs_srcdir@/export_stats.dmp'); - -/* - * No.17-5 dbms_stats.import_column_stats (relid, attname, src) - */ --- No.17-5-1 -SELECT dbms_stats.import_column_stats('s0.st0', 'id', '@abs_srcdir@/export_stats.dmp'); - -/* - * No.17-6 dbms_stats.import_column_stats (schemaname, tablename, attname, src) - */ --- No.17-6-1 -SELECT dbms_stats.import_column_stats('s0', 'st0', 'id','@abs_srcdir@/export_stats.dmp'); - -/* - * Delete stab function dbms_stats.import - */ -DROP FUNCTION dbms_stats.import( - nspname text, - relid regclass, - attname text, - src text -); -ALTER FUNCTION dbms_stats.truth_import( - nspname text, - relid regclass, - attname text, - src text -) RENAME TO import; diff --git a/output/ut_imp_exp.source b/output/ut_imp_exp.source deleted file mode 100644 index b1d74ed..0000000 --- a/output/ut_imp_exp.source +++ /dev/null @@ -1,2417 +0,0 @@ -\pset null '(null)' -CREATE TABLE s0.st3(); -/* - * No.16-1 export_plain_stats-14.sql.sample - */ --- No.16-1-1 -ANALYZE; -DELETE FROM dbms_stats.column_stats_locked; -DELETE FROM dbms_stats.relation_stats_locked; -SELECT dbms_stats.lock_database_stats(); - lock_database_stats ---------------------- - pt0 - pt0_idx - st0 - st0_idx - st1 - s0.st0 - s0.st0_idx - s0.st1 - s0.st1_idx - s0.st2 - s0.st2_idx - st1_idx - st1_exp - s0.sft0 - s0.smv0 - s1.st0 - s0.st3 -(17 rows) - -UPDATE dbms_stats.relation_stats_locked - SET (relpages, reltuples, relallvisible, curpages) = (0,0,0,0); -UPDATE dbms_stats.column_stats_locked SET - stanullfrac = -staattnum, - stawidth = -staattnum, - stadistinct = -staattnum, - stakind1 = 2, - stakind2 = 3, - stakind3 = 4, - stakind4 = 1, - stakind5 = 5, - staop1 = 22, - staop2 = 23, - staop3 = 24, - staop4 = 21, - staop5 = 25, - stacoll1 = 32, - stacoll2 = 33, - stacoll3 = 34, - stacoll4 = 31, - stacoll5 = 35, - stanumbers1 = ARRAY[-staattnum,22], - stanumbers2 = ARRAY[-staattnum,23], - stanumbers3 = ARRAY[-staattnum,24], - stanumbers4 = ARRAY[-staattnum,21], - stanumbers5 = ARRAY[-staattnum,25], - stavalues1 = stavalues3, - stavalues2 = stavalues2, - stavalues3 = stavalues1, - stavalues4 = stavalues4, - stavalues5 = stavalues5; -\i doc/export_plain_stats-14.sql.sample -/* - * If you want the statistics of per-relation or per-column, please modify - * nspname, relname, and attname in 'WHERE' clause. - */ -BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; -/* - * If you want to chage the output file name, please modify the following name. - */ -\o export_stats.dmp -COPY (SELECT n2.nspname, - c.relname, - c.relpages, - c.reltuples, - c.relallvisible, - (pg_catalog.pg_relation_size(c.oid) / - pg_catalog.current_setting('block_size')::int4)::int4 - AS curpages, - pg_catalog.pg_stat_get_last_analyze_time(c.oid) - AS last_analyze, - pg_catalog.pg_stat_get_last_autoanalyze_time(c.oid) - AS last_autoanalyze, - COALESCE(a.attname, ''), - n1.nspname AS schemaname_of_atttype, - t.typname, - a.atttypmod, - s.stainherit, - s.stanullfrac, - s.stawidth, - s.stadistinct, - s.stakind1, - s.stakind2, - s.stakind3, - s.stakind4, - s.stakind5, - s.staop1, - s.staop2, - s.staop3, - s.staop4, - s.staop5, - s.stacoll1, - s.stacoll2, - s.stacoll3, - s.stacoll4, - s.stacoll5, - s.stanumbers1, - s.stanumbers2, - s.stanumbers3, - s.stanumbers4, - s.stanumbers5, - s.stavalues1, - s.stavalues2, - s.stavalues3, - s.stavalues4, - s.stavalues5 - FROM pg_statistic s - JOIN pg_attribute a - ON (s.starelid = a.attrelid AND s.staattnum = a.attnum) - JOIN pg_type t - ON a.atttypid = t.oid - JOIN pg_namespace n1 - ON t.typnamespace = n1.oid - RIGHT JOIN pg_catalog.pg_class c - ON s.starelid = c.oid - JOIN pg_catalog.pg_namespace n2 - ON c.relnamespace = n2.oid - WHERE c.relkind IN ('r', 'i', 'f', 'm') - AND NOT n2.nspname IN ('pg_catalog', - 'pg_toast', - 'information_schema', - 'dbms_stats') - -- AND n2.nspname = 'public' - -- AND c.relname = 'test' - -- AND a.attname = 'id' - ORDER BY starelid, staattnum) -TO STDOUT -(FORMAT 'binary'); -\o -COMMIT; -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; - nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ----------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+------------------------+-------------+-------------+-------------+-------------+------------------------+------------+------------+------------+------------ - public | pt0 | 0 | 0 | 0 | 0 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) - public | pt0_idx | 2 | 0 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) - public | st0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2} | (null) | (null) | (null) | (null) - public | st0 | 1 | 2 | 1 | 1 | name | pg_catalog | bpchar | 9 | f | 0 | 6 | -0.5 | 1 | 3 | 0 | 0 | 0 | 1054 | 1058 | 0 | 0 | 0 | 100 | 100 | 0 | 0 | 0 | {1} | {1} | (null) | (null) | (null) | {"test "} | (null) | (null) | (null) | (null) - public | st0_idx | 2 | 2 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) - public | st1 | 45 | 10000 | 45 | 45 | str | pg_catalog | text | -1 | f | 0 | 2 | 3 | 1 | 3 | 0 | 0 | 0 | 98 | 664 | 0 | 0 | 0 | 100 | 100 | 0 | 0 | 0 | {0.3334,0.3333,0.3333} | {0.3332} | (null) | (null) | (null) | {1,0,2} | (null) | (null) | (null) | (null) - public | st1 | 45 | 10000 | 45 | 45 | val | pg_catalog | int4 | -1 | f | 0 | 4 | 3 | 1 | 3 | 0 | 0 | 0 | 96 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | {0.3334,0.3333,0.3333} | {0.3332} | (null) | (null) | (null) | {1,0,2} | (null) | (null) | (null) | (null) - public | st1_exp | 11 | 10000 | 0 | 11 | lower | pg_catalog | text | -1 | f | 0 | 5 | 3 | 1 | 3 | 0 | 0 | 0 | 98 | 664 | 0 | 0 | 0 | 100 | 100 | 0 | 0 | 0 | {0.3334,0.3333,0.3333} | {0.3332} | (null) | (null) | (null) | {1,0,2} | (null) | (null) | (null) | (null) - public | st1_idx | 11 | 10000 | 0 | 11 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) - s0 | sft0 | 1 | 10 | 0 | 0 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2,3,4,5,6,7,8,9,10} | (null) | (null) | (null) | (null) - s0 | smv0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2} | (null) | (null) | (null) | (null) - s0 | smv0 | 1 | 2 | 1 | 1 | num | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {10,20} | (null) | (null) | (null) | (null) - s0 | smv0 | 1 | 2 | 1 | 1 | txt | pg_catalog | text | -1 | f | 0 | 3 | -1 | 2 | 3 | 0 | 0 | 0 | 664 | 664 | 0 | 0 | 0 | 100 | 100 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,test} | (null) | (null) | (null) | (null) - s0 | st0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2} | (null) | (null) | (null) | (null) - s0 | st0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | t | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2,4,5,6} | (null) | (null) | (null) | (null) - s0 | st0 | 1 | 2 | 1 | 1 | num | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {10,20} | (null) | (null) | (null) | (null) - s0 | st0 | 1 | 2 | 1 | 1 | num | pg_catalog | int4 | -1 | t | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {10,20,40,50,60} | (null) | (null) | (null) | (null) - s0 | st0_idx | 2 | 2 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) - s0 | st1 | 1 | 3 | 1 | 1 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {4,5,6} | (null) | (null) | (null) | (null) - s0 | st1 | 1 | 3 | 1 | 1 | num | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {40,50,60} | (null) | (null) | (null) | (null) - s0 | st1_idx | 2 | 3 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) - s0 | st2 | 1 | 3 | 1 | 1 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2,3} | (null) | (null) | (null) | (null) - s0 | st2 | 1 | 3 | 1 | 1 | txt | pg_catalog | text | -1 | f | 0 | 5 | -1 | 2 | 3 | 0 | 0 | 0 | 664 | 664 | 0 | 0 | 0 | 100 | 100 | 0 | 0 | 0 | (null) | {0.5} | (null) | (null) | (null) | {1,comment,test} | (null) | (null) | (null) | (null) - s0 | st2_idx | 2 | 3 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) - s0 | st3 | 0 | 0 | 0 | 0 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) - s1 | st0 | 1 | 4 | 1 | 1 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2,3,4} | (null) | (null) | (null) | (null) - s1 | st0 | 1 | 4 | 1 | 1 | num | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {15,25,35,45} | (null) | (null) | (null) | (null) -(27 rows) - -TRUNCATE dbms_stats.work; --- No.16-1-2 -\! sed '/ORDER/i\\ AND n2.nspname = '"\'s0\'" doc/export_plain_stats-14.sql.sample > doc/export_plain_stats-14.sql.sample_test -\i doc/export_plain_stats-14.sql.sample_test -/* - * If you want the statistics of per-relation or per-column, please modify - * nspname, relname, and attname in 'WHERE' clause. - */ -BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; -/* - * If you want to chage the output file name, please modify the following name. - */ -\o export_stats.dmp -COPY (SELECT n2.nspname, - c.relname, - c.relpages, - c.reltuples, - c.relallvisible, - (pg_catalog.pg_relation_size(c.oid) / - pg_catalog.current_setting('block_size')::int4)::int4 - AS curpages, - pg_catalog.pg_stat_get_last_analyze_time(c.oid) - AS last_analyze, - pg_catalog.pg_stat_get_last_autoanalyze_time(c.oid) - AS last_autoanalyze, - COALESCE(a.attname, ''), - n1.nspname AS schemaname_of_atttype, - t.typname, - a.atttypmod, - s.stainherit, - s.stanullfrac, - s.stawidth, - s.stadistinct, - s.stakind1, - s.stakind2, - s.stakind3, - s.stakind4, - s.stakind5, - s.staop1, - s.staop2, - s.staop3, - s.staop4, - s.staop5, - s.stacoll1, - s.stacoll2, - s.stacoll3, - s.stacoll4, - s.stacoll5, - s.stanumbers1, - s.stanumbers2, - s.stanumbers3, - s.stanumbers4, - s.stanumbers5, - s.stavalues1, - s.stavalues2, - s.stavalues3, - s.stavalues4, - s.stavalues5 - FROM pg_statistic s - JOIN pg_attribute a - ON (s.starelid = a.attrelid AND s.staattnum = a.attnum) - JOIN pg_type t - ON a.atttypid = t.oid - JOIN pg_namespace n1 - ON t.typnamespace = n1.oid - RIGHT JOIN pg_catalog.pg_class c - ON s.starelid = c.oid - JOIN pg_catalog.pg_namespace n2 - ON c.relnamespace = n2.oid - WHERE c.relkind IN ('r', 'i', 'f', 'm') - AND NOT n2.nspname IN ('pg_catalog', - 'pg_toast', - 'information_schema', - 'dbms_stats') - -- AND n2.nspname = 'public' - -- AND c.relname = 'test' - -- AND a.attname = 'id' - AND n2.nspname = 's0' - ORDER BY starelid, staattnum) -TO STDOUT -(FORMAT 'binary'); -\o -COMMIT; -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; - nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ----------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+------------------------+------------+------------+------------+------------ - s0 | sft0 | 1 | 10 | 0 | 0 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2,3,4,5,6,7,8,9,10} | (null) | (null) | (null) | (null) - s0 | smv0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2} | (null) | (null) | (null) | (null) - s0 | smv0 | 1 | 2 | 1 | 1 | num | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {10,20} | (null) | (null) | (null) | (null) - s0 | smv0 | 1 | 2 | 1 | 1 | txt | pg_catalog | text | -1 | f | 0 | 3 | -1 | 2 | 3 | 0 | 0 | 0 | 664 | 664 | 0 | 0 | 0 | 100 | 100 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,test} | (null) | (null) | (null) | (null) - s0 | st0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2} | (null) | (null) | (null) | (null) - s0 | st0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | t | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2,4,5,6} | (null) | (null) | (null) | (null) - s0 | st0 | 1 | 2 | 1 | 1 | num | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {10,20} | (null) | (null) | (null) | (null) - s0 | st0 | 1 | 2 | 1 | 1 | num | pg_catalog | int4 | -1 | t | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {10,20,40,50,60} | (null) | (null) | (null) | (null) - s0 | st0_idx | 2 | 2 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) - s0 | st1 | 1 | 3 | 1 | 1 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {4,5,6} | (null) | (null) | (null) | (null) - s0 | st1 | 1 | 3 | 1 | 1 | num | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {40,50,60} | (null) | (null) | (null) | (null) - s0 | st1_idx | 2 | 3 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) - s0 | st2 | 1 | 3 | 1 | 1 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2,3} | (null) | (null) | (null) | (null) - s0 | st2 | 1 | 3 | 1 | 1 | txt | pg_catalog | text | -1 | f | 0 | 5 | -1 | 2 | 3 | 0 | 0 | 0 | 664 | 664 | 0 | 0 | 0 | 100 | 100 | 0 | 0 | 0 | (null) | {0.5} | (null) | (null) | (null) | {1,comment,test} | (null) | (null) | (null) | (null) - s0 | st2_idx | 2 | 3 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) - s0 | st3 | 0 | 0 | 0 | 0 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) -(16 rows) - -TRUNCATE dbms_stats.work; -\! rm doc/export_plain_stats-14.sql.sample_test --- No.16-1-3 -\! sed '/ORDER/i\\ AND c.relname = '"\'st0\'" doc/export_plain_stats-14.sql.sample > doc/export_plain_stats-14.sql.sample_test -\i doc/export_plain_stats-14.sql.sample_test -/* - * If you want the statistics of per-relation or per-column, please modify - * nspname, relname, and attname in 'WHERE' clause. - */ -BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; -/* - * If you want to chage the output file name, please modify the following name. - */ -\o export_stats.dmp -COPY (SELECT n2.nspname, - c.relname, - c.relpages, - c.reltuples, - c.relallvisible, - (pg_catalog.pg_relation_size(c.oid) / - pg_catalog.current_setting('block_size')::int4)::int4 - AS curpages, - pg_catalog.pg_stat_get_last_analyze_time(c.oid) - AS last_analyze, - pg_catalog.pg_stat_get_last_autoanalyze_time(c.oid) - AS last_autoanalyze, - COALESCE(a.attname, ''), - n1.nspname AS schemaname_of_atttype, - t.typname, - a.atttypmod, - s.stainherit, - s.stanullfrac, - s.stawidth, - s.stadistinct, - s.stakind1, - s.stakind2, - s.stakind3, - s.stakind4, - s.stakind5, - s.staop1, - s.staop2, - s.staop3, - s.staop4, - s.staop5, - s.stacoll1, - s.stacoll2, - s.stacoll3, - s.stacoll4, - s.stacoll5, - s.stanumbers1, - s.stanumbers2, - s.stanumbers3, - s.stanumbers4, - s.stanumbers5, - s.stavalues1, - s.stavalues2, - s.stavalues3, - s.stavalues4, - s.stavalues5 - FROM pg_statistic s - JOIN pg_attribute a - ON (s.starelid = a.attrelid AND s.staattnum = a.attnum) - JOIN pg_type t - ON a.atttypid = t.oid - JOIN pg_namespace n1 - ON t.typnamespace = n1.oid - RIGHT JOIN pg_catalog.pg_class c - ON s.starelid = c.oid - JOIN pg_catalog.pg_namespace n2 - ON c.relnamespace = n2.oid - WHERE c.relkind IN ('r', 'i', 'f', 'm') - AND NOT n2.nspname IN ('pg_catalog', - 'pg_toast', - 'information_schema', - 'dbms_stats') - -- AND n2.nspname = 'public' - -- AND c.relname = 'test' - -- AND a.attname = 'id' - AND c.relname = 'st0' - ORDER BY starelid, staattnum) -TO STDOUT -(FORMAT 'binary'); -\o -COMMIT; -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; - nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ----------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+------------------+------------+------------+------------+------------ - public | st0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2} | (null) | (null) | (null) | (null) - public | st0 | 1 | 2 | 1 | 1 | name | pg_catalog | bpchar | 9 | f | 0 | 6 | -0.5 | 1 | 3 | 0 | 0 | 0 | 1054 | 1058 | 0 | 0 | 0 | 100 | 100 | 0 | 0 | 0 | {1} | {1} | (null) | (null) | (null) | {"test "} | (null) | (null) | (null) | (null) - s0 | st0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2} | (null) | (null) | (null) | (null) - s0 | st0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | t | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2,4,5,6} | (null) | (null) | (null) | (null) - s0 | st0 | 1 | 2 | 1 | 1 | num | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {10,20} | (null) | (null) | (null) | (null) - s0 | st0 | 1 | 2 | 1 | 1 | num | pg_catalog | int4 | -1 | t | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {10,20,40,50,60} | (null) | (null) | (null) | (null) - s1 | st0 | 1 | 4 | 1 | 1 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2,3,4} | (null) | (null) | (null) | (null) - s1 | st0 | 1 | 4 | 1 | 1 | num | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {15,25,35,45} | (null) | (null) | (null) | (null) -(8 rows) - -TRUNCATE dbms_stats.work; -\! rm doc/export_plain_stats-14.sql.sample_test --- No.16-1-3-1 Actual import test -select dbms_stats.import_database_stats('@abs_srcdir@/export_stats.dmp'); - import_database_stats ------------------------ - -(1 row) - --- No.16-1-4 -\! sed '/ORDER/i\\ AND c.relname = '"\'pg_toast_1262\'" doc/export_plain_stats-14.sql.sample > doc/export_plain_stats-14.sql.sample_test -\i doc/export_plain_stats-14.sql.sample_test -/* - * If you want the statistics of per-relation or per-column, please modify - * nspname, relname, and attname in 'WHERE' clause. - */ -BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; -/* - * If you want to chage the output file name, please modify the following name. - */ -\o export_stats.dmp -COPY (SELECT n2.nspname, - c.relname, - c.relpages, - c.reltuples, - c.relallvisible, - (pg_catalog.pg_relation_size(c.oid) / - pg_catalog.current_setting('block_size')::int4)::int4 - AS curpages, - pg_catalog.pg_stat_get_last_analyze_time(c.oid) - AS last_analyze, - pg_catalog.pg_stat_get_last_autoanalyze_time(c.oid) - AS last_autoanalyze, - COALESCE(a.attname, ''), - n1.nspname AS schemaname_of_atttype, - t.typname, - a.atttypmod, - s.stainherit, - s.stanullfrac, - s.stawidth, - s.stadistinct, - s.stakind1, - s.stakind2, - s.stakind3, - s.stakind4, - s.stakind5, - s.staop1, - s.staop2, - s.staop3, - s.staop4, - s.staop5, - s.stacoll1, - s.stacoll2, - s.stacoll3, - s.stacoll4, - s.stacoll5, - s.stanumbers1, - s.stanumbers2, - s.stanumbers3, - s.stanumbers4, - s.stanumbers5, - s.stavalues1, - s.stavalues2, - s.stavalues3, - s.stavalues4, - s.stavalues5 - FROM pg_statistic s - JOIN pg_attribute a - ON (s.starelid = a.attrelid AND s.staattnum = a.attnum) - JOIN pg_type t - ON a.atttypid = t.oid - JOIN pg_namespace n1 - ON t.typnamespace = n1.oid - RIGHT JOIN pg_catalog.pg_class c - ON s.starelid = c.oid - JOIN pg_catalog.pg_namespace n2 - ON c.relnamespace = n2.oid - WHERE c.relkind IN ('r', 'i', 'f', 'm') - AND NOT n2.nspname IN ('pg_catalog', - 'pg_toast', - 'information_schema', - 'dbms_stats') - -- AND n2.nspname = 'public' - -- AND c.relname = 'test' - -- AND a.attname = 'id' - AND c.relname = 'pg_toast_1262' - ORDER BY starelid, staattnum) -TO STDOUT -(FORMAT 'binary'); -\o -COMMIT; -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; - nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ----------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------ -(0 rows) - -TRUNCATE dbms_stats.work; -\! rm doc/export_plain_stats-14.sql.sample_test --- No.16-1-5 -\! sed '/ORDER/i\\ AND c.relname = '"\'st0_idx\'" doc/export_plain_stats-14.sql.sample > doc/export_plain_stats-14.sql.sample_test -\i doc/export_plain_stats-14.sql.sample_test -/* - * If you want the statistics of per-relation or per-column, please modify - * nspname, relname, and attname in 'WHERE' clause. - */ -BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; -/* - * If you want to chage the output file name, please modify the following name. - */ -\o export_stats.dmp -COPY (SELECT n2.nspname, - c.relname, - c.relpages, - c.reltuples, - c.relallvisible, - (pg_catalog.pg_relation_size(c.oid) / - pg_catalog.current_setting('block_size')::int4)::int4 - AS curpages, - pg_catalog.pg_stat_get_last_analyze_time(c.oid) - AS last_analyze, - pg_catalog.pg_stat_get_last_autoanalyze_time(c.oid) - AS last_autoanalyze, - COALESCE(a.attname, ''), - n1.nspname AS schemaname_of_atttype, - t.typname, - a.atttypmod, - s.stainherit, - s.stanullfrac, - s.stawidth, - s.stadistinct, - s.stakind1, - s.stakind2, - s.stakind3, - s.stakind4, - s.stakind5, - s.staop1, - s.staop2, - s.staop3, - s.staop4, - s.staop5, - s.stacoll1, - s.stacoll2, - s.stacoll3, - s.stacoll4, - s.stacoll5, - s.stanumbers1, - s.stanumbers2, - s.stanumbers3, - s.stanumbers4, - s.stanumbers5, - s.stavalues1, - s.stavalues2, - s.stavalues3, - s.stavalues4, - s.stavalues5 - FROM pg_statistic s - JOIN pg_attribute a - ON (s.starelid = a.attrelid AND s.staattnum = a.attnum) - JOIN pg_type t - ON a.atttypid = t.oid - JOIN pg_namespace n1 - ON t.typnamespace = n1.oid - RIGHT JOIN pg_catalog.pg_class c - ON s.starelid = c.oid - JOIN pg_catalog.pg_namespace n2 - ON c.relnamespace = n2.oid - WHERE c.relkind IN ('r', 'i', 'f', 'm') - AND NOT n2.nspname IN ('pg_catalog', - 'pg_toast', - 'information_schema', - 'dbms_stats') - -- AND n2.nspname = 'public' - -- AND c.relname = 'test' - -- AND a.attname = 'id' - AND c.relname = 'st0_idx' - ORDER BY starelid, staattnum) -TO STDOUT -(FORMAT 'binary'); -\o -COMMIT; -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; - nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ----------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------ - public | st0_idx | 2 | 2 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) - s0 | st0_idx | 2 | 2 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) -(2 rows) - -TRUNCATE dbms_stats.work; -\! rm doc/export_plain_stats-14.sql.sample_test --- No.16-1-6 -\! sed '/ORDER/i\\ AND c.relname = '"\'ss0\'" doc/export_plain_stats-14.sql.sample > doc/export_plain_stats-14.sql.sample_test -\i doc/export_plain_stats-14.sql.sample_test -/* - * If you want the statistics of per-relation or per-column, please modify - * nspname, relname, and attname in 'WHERE' clause. - */ -BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; -/* - * If you want to chage the output file name, please modify the following name. - */ -\o export_stats.dmp -COPY (SELECT n2.nspname, - c.relname, - c.relpages, - c.reltuples, - c.relallvisible, - (pg_catalog.pg_relation_size(c.oid) / - pg_catalog.current_setting('block_size')::int4)::int4 - AS curpages, - pg_catalog.pg_stat_get_last_analyze_time(c.oid) - AS last_analyze, - pg_catalog.pg_stat_get_last_autoanalyze_time(c.oid) - AS last_autoanalyze, - COALESCE(a.attname, ''), - n1.nspname AS schemaname_of_atttype, - t.typname, - a.atttypmod, - s.stainherit, - s.stanullfrac, - s.stawidth, - s.stadistinct, - s.stakind1, - s.stakind2, - s.stakind3, - s.stakind4, - s.stakind5, - s.staop1, - s.staop2, - s.staop3, - s.staop4, - s.staop5, - s.stacoll1, - s.stacoll2, - s.stacoll3, - s.stacoll4, - s.stacoll5, - s.stanumbers1, - s.stanumbers2, - s.stanumbers3, - s.stanumbers4, - s.stanumbers5, - s.stavalues1, - s.stavalues2, - s.stavalues3, - s.stavalues4, - s.stavalues5 - FROM pg_statistic s - JOIN pg_attribute a - ON (s.starelid = a.attrelid AND s.staattnum = a.attnum) - JOIN pg_type t - ON a.atttypid = t.oid - JOIN pg_namespace n1 - ON t.typnamespace = n1.oid - RIGHT JOIN pg_catalog.pg_class c - ON s.starelid = c.oid - JOIN pg_catalog.pg_namespace n2 - ON c.relnamespace = n2.oid - WHERE c.relkind IN ('r', 'i', 'f', 'm') - AND NOT n2.nspname IN ('pg_catalog', - 'pg_toast', - 'information_schema', - 'dbms_stats') - -- AND n2.nspname = 'public' - -- AND c.relname = 'test' - -- AND a.attname = 'id' - AND c.relname = 'ss0' - ORDER BY starelid, staattnum) -TO STDOUT -(FORMAT 'binary'); -\o -COMMIT; -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; - nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ----------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------ -(0 rows) - -TRUNCATE dbms_stats.work; -\! rm doc/export_plain_stats-14.sql.sample_test --- No.16-1-7 -\! sed '/ORDER/i\\ AND c.relname = '"\'sc0\'" doc/export_plain_stats-14.sql.sample > doc/export_plain_stats-14.sql.sample_test -\i doc/export_plain_stats-14.sql.sample_test -/* - * If you want the statistics of per-relation or per-column, please modify - * nspname, relname, and attname in 'WHERE' clause. - */ -BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; -/* - * If you want to chage the output file name, please modify the following name. - */ -\o export_stats.dmp -COPY (SELECT n2.nspname, - c.relname, - c.relpages, - c.reltuples, - c.relallvisible, - (pg_catalog.pg_relation_size(c.oid) / - pg_catalog.current_setting('block_size')::int4)::int4 - AS curpages, - pg_catalog.pg_stat_get_last_analyze_time(c.oid) - AS last_analyze, - pg_catalog.pg_stat_get_last_autoanalyze_time(c.oid) - AS last_autoanalyze, - COALESCE(a.attname, ''), - n1.nspname AS schemaname_of_atttype, - t.typname, - a.atttypmod, - s.stainherit, - s.stanullfrac, - s.stawidth, - s.stadistinct, - s.stakind1, - s.stakind2, - s.stakind3, - s.stakind4, - s.stakind5, - s.staop1, - s.staop2, - s.staop3, - s.staop4, - s.staop5, - s.stacoll1, - s.stacoll2, - s.stacoll3, - s.stacoll4, - s.stacoll5, - s.stanumbers1, - s.stanumbers2, - s.stanumbers3, - s.stanumbers4, - s.stanumbers5, - s.stavalues1, - s.stavalues2, - s.stavalues3, - s.stavalues4, - s.stavalues5 - FROM pg_statistic s - JOIN pg_attribute a - ON (s.starelid = a.attrelid AND s.staattnum = a.attnum) - JOIN pg_type t - ON a.atttypid = t.oid - JOIN pg_namespace n1 - ON t.typnamespace = n1.oid - RIGHT JOIN pg_catalog.pg_class c - ON s.starelid = c.oid - JOIN pg_catalog.pg_namespace n2 - ON c.relnamespace = n2.oid - WHERE c.relkind IN ('r', 'i', 'f', 'm') - AND NOT n2.nspname IN ('pg_catalog', - 'pg_toast', - 'information_schema', - 'dbms_stats') - -- AND n2.nspname = 'public' - -- AND c.relname = 'test' - -- AND a.attname = 'id' - AND c.relname = 'sc0' - ORDER BY starelid, staattnum) -TO STDOUT -(FORMAT 'binary'); -\o -COMMIT; -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; - nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ----------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------ -(0 rows) - -TRUNCATE dbms_stats.work; -\! rm doc/export_plain_stats-14.sql.sample_test --- No.16-1-8 -\! sed '/ORDER/i\\ AND c.relname = '"\'sft0\'" doc/export_plain_stats-14.sql.sample > doc/export_plain_stats-14.sql.sample_test -\i doc/export_plain_stats-14.sql.sample_test -/* - * If you want the statistics of per-relation or per-column, please modify - * nspname, relname, and attname in 'WHERE' clause. - */ -BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; -/* - * If you want to chage the output file name, please modify the following name. - */ -\o export_stats.dmp -COPY (SELECT n2.nspname, - c.relname, - c.relpages, - c.reltuples, - c.relallvisible, - (pg_catalog.pg_relation_size(c.oid) / - pg_catalog.current_setting('block_size')::int4)::int4 - AS curpages, - pg_catalog.pg_stat_get_last_analyze_time(c.oid) - AS last_analyze, - pg_catalog.pg_stat_get_last_autoanalyze_time(c.oid) - AS last_autoanalyze, - COALESCE(a.attname, ''), - n1.nspname AS schemaname_of_atttype, - t.typname, - a.atttypmod, - s.stainherit, - s.stanullfrac, - s.stawidth, - s.stadistinct, - s.stakind1, - s.stakind2, - s.stakind3, - s.stakind4, - s.stakind5, - s.staop1, - s.staop2, - s.staop3, - s.staop4, - s.staop5, - s.stacoll1, - s.stacoll2, - s.stacoll3, - s.stacoll4, - s.stacoll5, - s.stanumbers1, - s.stanumbers2, - s.stanumbers3, - s.stanumbers4, - s.stanumbers5, - s.stavalues1, - s.stavalues2, - s.stavalues3, - s.stavalues4, - s.stavalues5 - FROM pg_statistic s - JOIN pg_attribute a - ON (s.starelid = a.attrelid AND s.staattnum = a.attnum) - JOIN pg_type t - ON a.atttypid = t.oid - JOIN pg_namespace n1 - ON t.typnamespace = n1.oid - RIGHT JOIN pg_catalog.pg_class c - ON s.starelid = c.oid - JOIN pg_catalog.pg_namespace n2 - ON c.relnamespace = n2.oid - WHERE c.relkind IN ('r', 'i', 'f', 'm') - AND NOT n2.nspname IN ('pg_catalog', - 'pg_toast', - 'information_schema', - 'dbms_stats') - -- AND n2.nspname = 'public' - -- AND c.relname = 'test' - -- AND a.attname = 'id' - AND c.relname = 'sft0' - ORDER BY starelid, staattnum) -TO STDOUT -(FORMAT 'binary'); -\o -COMMIT; -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; - nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ----------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+------------------------+------------+------------+------------+------------ - s0 | sft0 | 1 | 10 | 0 | 0 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2,3,4,5,6,7,8,9,10} | (null) | (null) | (null) | (null) -(1 row) - -TRUNCATE dbms_stats.work; -\! rm doc/export_plain_stats-14.sql.sample_test --- No.16-1-9 -\! sed '/ORDER/i\\ AND c.relname = '"\'smv0\'" doc/export_plain_stats-14.sql.sample > doc/export_plain_stats-14.sql.sample_test -\i doc/export_plain_stats-14.sql.sample_test -/* - * If you want the statistics of per-relation or per-column, please modify - * nspname, relname, and attname in 'WHERE' clause. - */ -BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; -/* - * If you want to chage the output file name, please modify the following name. - */ -\o export_stats.dmp -COPY (SELECT n2.nspname, - c.relname, - c.relpages, - c.reltuples, - c.relallvisible, - (pg_catalog.pg_relation_size(c.oid) / - pg_catalog.current_setting('block_size')::int4)::int4 - AS curpages, - pg_catalog.pg_stat_get_last_analyze_time(c.oid) - AS last_analyze, - pg_catalog.pg_stat_get_last_autoanalyze_time(c.oid) - AS last_autoanalyze, - COALESCE(a.attname, ''), - n1.nspname AS schemaname_of_atttype, - t.typname, - a.atttypmod, - s.stainherit, - s.stanullfrac, - s.stawidth, - s.stadistinct, - s.stakind1, - s.stakind2, - s.stakind3, - s.stakind4, - s.stakind5, - s.staop1, - s.staop2, - s.staop3, - s.staop4, - s.staop5, - s.stacoll1, - s.stacoll2, - s.stacoll3, - s.stacoll4, - s.stacoll5, - s.stanumbers1, - s.stanumbers2, - s.stanumbers3, - s.stanumbers4, - s.stanumbers5, - s.stavalues1, - s.stavalues2, - s.stavalues3, - s.stavalues4, - s.stavalues5 - FROM pg_statistic s - JOIN pg_attribute a - ON (s.starelid = a.attrelid AND s.staattnum = a.attnum) - JOIN pg_type t - ON a.atttypid = t.oid - JOIN pg_namespace n1 - ON t.typnamespace = n1.oid - RIGHT JOIN pg_catalog.pg_class c - ON s.starelid = c.oid - JOIN pg_catalog.pg_namespace n2 - ON c.relnamespace = n2.oid - WHERE c.relkind IN ('r', 'i', 'f', 'm') - AND NOT n2.nspname IN ('pg_catalog', - 'pg_toast', - 'information_schema', - 'dbms_stats') - -- AND n2.nspname = 'public' - -- AND c.relname = 'test' - -- AND a.attname = 'id' - AND c.relname = 'smv0' - ORDER BY starelid, staattnum) -TO STDOUT -(FORMAT 'binary'); -\o -COMMIT; -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; - nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ----------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------ - s0 | smv0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2} | (null) | (null) | (null) | (null) - s0 | smv0 | 1 | 2 | 1 | 1 | num | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {10,20} | (null) | (null) | (null) | (null) - s0 | smv0 | 1 | 2 | 1 | 1 | txt | pg_catalog | text | -1 | f | 0 | 3 | -1 | 2 | 3 | 0 | 0 | 0 | 664 | 664 | 0 | 0 | 0 | 100 | 100 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,test} | (null) | (null) | (null) | (null) -(3 rows) - -TRUNCATE dbms_stats.work; -\! rm doc/export_plain_stats-14.sql.sample_test --- No.16-1-10 -\! sed '/ORDER/i\\ AND n2.nspname = '"\'s0\'"' AND a.attname = '\'id\' doc/export_plain_stats-14.sql.sample > doc/export_plain_stats-14.sql.sample_test -\i doc/export_plain_stats-14.sql.sample_test -/* - * If you want the statistics of per-relation or per-column, please modify - * nspname, relname, and attname in 'WHERE' clause. - */ -BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; -/* - * If you want to chage the output file name, please modify the following name. - */ -\o export_stats.dmp -COPY (SELECT n2.nspname, - c.relname, - c.relpages, - c.reltuples, - c.relallvisible, - (pg_catalog.pg_relation_size(c.oid) / - pg_catalog.current_setting('block_size')::int4)::int4 - AS curpages, - pg_catalog.pg_stat_get_last_analyze_time(c.oid) - AS last_analyze, - pg_catalog.pg_stat_get_last_autoanalyze_time(c.oid) - AS last_autoanalyze, - COALESCE(a.attname, ''), - n1.nspname AS schemaname_of_atttype, - t.typname, - a.atttypmod, - s.stainherit, - s.stanullfrac, - s.stawidth, - s.stadistinct, - s.stakind1, - s.stakind2, - s.stakind3, - s.stakind4, - s.stakind5, - s.staop1, - s.staop2, - s.staop3, - s.staop4, - s.staop5, - s.stacoll1, - s.stacoll2, - s.stacoll3, - s.stacoll4, - s.stacoll5, - s.stanumbers1, - s.stanumbers2, - s.stanumbers3, - s.stanumbers4, - s.stanumbers5, - s.stavalues1, - s.stavalues2, - s.stavalues3, - s.stavalues4, - s.stavalues5 - FROM pg_statistic s - JOIN pg_attribute a - ON (s.starelid = a.attrelid AND s.staattnum = a.attnum) - JOIN pg_type t - ON a.atttypid = t.oid - JOIN pg_namespace n1 - ON t.typnamespace = n1.oid - RIGHT JOIN pg_catalog.pg_class c - ON s.starelid = c.oid - JOIN pg_catalog.pg_namespace n2 - ON c.relnamespace = n2.oid - WHERE c.relkind IN ('r', 'i', 'f', 'm') - AND NOT n2.nspname IN ('pg_catalog', - 'pg_toast', - 'information_schema', - 'dbms_stats') - -- AND n2.nspname = 'public' - -- AND c.relname = 'test' - -- AND a.attname = 'id' - AND n2.nspname = 's0' AND a.attname = 'id' - ORDER BY starelid, staattnum) -TO STDOUT -(FORMAT 'binary'); -\o -COMMIT; -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; - nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ----------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+------------------------+------------+------------+------------+------------ - s0 | sft0 | 1 | 10 | 0 | 0 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2,3,4,5,6,7,8,9,10} | (null) | (null) | (null) | (null) - s0 | smv0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2} | (null) | (null) | (null) | (null) - s0 | st0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2} | (null) | (null) | (null) | (null) - s0 | st0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | t | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2,4,5,6} | (null) | (null) | (null) | (null) - s0 | st1 | 1 | 3 | 1 | 1 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {4,5,6} | (null) | (null) | (null) | (null) - s0 | st2 | 1 | 3 | 1 | 1 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2,3} | (null) | (null) | (null) | (null) -(6 rows) - -TRUNCATE dbms_stats.work; -\! rm doc/export_plain_stats-14.sql.sample_test --- No.16-1-11 -\! sed '/ORDER/i\\ AND n2.nspname = '"\'s0\'"' AND a.attname IS NULL' doc/export_plain_stats-14.sql.sample > doc/export_plain_stats-14.sql.sample_test -\i doc/export_plain_stats-14.sql.sample_test -/* - * If you want the statistics of per-relation or per-column, please modify - * nspname, relname, and attname in 'WHERE' clause. - */ -BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; -/* - * If you want to chage the output file name, please modify the following name. - */ -\o export_stats.dmp -COPY (SELECT n2.nspname, - c.relname, - c.relpages, - c.reltuples, - c.relallvisible, - (pg_catalog.pg_relation_size(c.oid) / - pg_catalog.current_setting('block_size')::int4)::int4 - AS curpages, - pg_catalog.pg_stat_get_last_analyze_time(c.oid) - AS last_analyze, - pg_catalog.pg_stat_get_last_autoanalyze_time(c.oid) - AS last_autoanalyze, - COALESCE(a.attname, ''), - n1.nspname AS schemaname_of_atttype, - t.typname, - a.atttypmod, - s.stainherit, - s.stanullfrac, - s.stawidth, - s.stadistinct, - s.stakind1, - s.stakind2, - s.stakind3, - s.stakind4, - s.stakind5, - s.staop1, - s.staop2, - s.staop3, - s.staop4, - s.staop5, - s.stacoll1, - s.stacoll2, - s.stacoll3, - s.stacoll4, - s.stacoll5, - s.stanumbers1, - s.stanumbers2, - s.stanumbers3, - s.stanumbers4, - s.stanumbers5, - s.stavalues1, - s.stavalues2, - s.stavalues3, - s.stavalues4, - s.stavalues5 - FROM pg_statistic s - JOIN pg_attribute a - ON (s.starelid = a.attrelid AND s.staattnum = a.attnum) - JOIN pg_type t - ON a.atttypid = t.oid - JOIN pg_namespace n1 - ON t.typnamespace = n1.oid - RIGHT JOIN pg_catalog.pg_class c - ON s.starelid = c.oid - JOIN pg_catalog.pg_namespace n2 - ON c.relnamespace = n2.oid - WHERE c.relkind IN ('r', 'i', 'f', 'm') - AND NOT n2.nspname IN ('pg_catalog', - 'pg_toast', - 'information_schema', - 'dbms_stats') - -- AND n2.nspname = 'public' - -- AND c.relname = 'test' - -- AND a.attname = 'id' - AND n2.nspname = 's0' AND a.attname IS NULL - ORDER BY starelid, staattnum) -TO STDOUT -(FORMAT 'binary'); -\o -COMMIT; -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; - nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ----------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------ - s0 | st0_idx | 2 | 2 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) - s0 | st1_idx | 2 | 3 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) - s0 | st2_idx | 2 | 3 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) - s0 | st3 | 0 | 0 | 0 | 0 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) -(4 rows) - -TRUNCATE dbms_stats.work; -\! rm doc/export_plain_stats-14.sql.sample_test --- No.16-1-12 -\! sed '/ORDER/i\\ AND n2.nspname = '"\'s1\'"' AND c.relname IS NULL' doc/export_plain_stats-14.sql.sample > doc/export_plain_stats-14.sql.sample_test -\i doc/export_plain_stats-14.sql.sample_test -/* - * If you want the statistics of per-relation or per-column, please modify - * nspname, relname, and attname in 'WHERE' clause. - */ -BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; -/* - * If you want to chage the output file name, please modify the following name. - */ -\o export_stats.dmp -COPY (SELECT n2.nspname, - c.relname, - c.relpages, - c.reltuples, - c.relallvisible, - (pg_catalog.pg_relation_size(c.oid) / - pg_catalog.current_setting('block_size')::int4)::int4 - AS curpages, - pg_catalog.pg_stat_get_last_analyze_time(c.oid) - AS last_analyze, - pg_catalog.pg_stat_get_last_autoanalyze_time(c.oid) - AS last_autoanalyze, - COALESCE(a.attname, ''), - n1.nspname AS schemaname_of_atttype, - t.typname, - a.atttypmod, - s.stainherit, - s.stanullfrac, - s.stawidth, - s.stadistinct, - s.stakind1, - s.stakind2, - s.stakind3, - s.stakind4, - s.stakind5, - s.staop1, - s.staop2, - s.staop3, - s.staop4, - s.staop5, - s.stacoll1, - s.stacoll2, - s.stacoll3, - s.stacoll4, - s.stacoll5, - s.stanumbers1, - s.stanumbers2, - s.stanumbers3, - s.stanumbers4, - s.stanumbers5, - s.stavalues1, - s.stavalues2, - s.stavalues3, - s.stavalues4, - s.stavalues5 - FROM pg_statistic s - JOIN pg_attribute a - ON (s.starelid = a.attrelid AND s.staattnum = a.attnum) - JOIN pg_type t - ON a.atttypid = t.oid - JOIN pg_namespace n1 - ON t.typnamespace = n1.oid - RIGHT JOIN pg_catalog.pg_class c - ON s.starelid = c.oid - JOIN pg_catalog.pg_namespace n2 - ON c.relnamespace = n2.oid - WHERE c.relkind IN ('r', 'i', 'f', 'm') - AND NOT n2.nspname IN ('pg_catalog', - 'pg_toast', - 'information_schema', - 'dbms_stats') - -- AND n2.nspname = 'public' - -- AND c.relname = 'test' - -- AND a.attname = 'id' - AND n2.nspname = 's1' AND c.relname IS NULL - ORDER BY starelid, staattnum) -TO STDOUT -(FORMAT 'binary'); -\o -COMMIT; -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; - nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ----------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------ -(0 rows) - -TRUNCATE dbms_stats.work; -\! rm doc/export_plain_stats-14.sql.sample_test -/* - * No.16-2 export_effective_stats-14.sql.sample - */ --- No.16-2-1 -VACUUM ANALYZE; -SELECT dbms_stats.lock_database_stats(); - lock_database_stats ---------------------- - pt0 - pt0_idx - st0 - st0_idx - st1 - s0.st0 - s0.st0_idx - s0.st1 - s0.st1_idx - s0.st2 - s0.st2_idx - st1_idx - st1_exp - s0.sft0 - s0.smv0 - s1.st0 - s0.st3 -(17 rows) - -UPDATE dbms_stats.relation_stats_locked - SET (relpages, reltuples, relallvisible, curpages) = (NULL, NULL, NULL, NULL); -UPDATE dbms_stats.column_stats_locked - SET (stanullfrac, stawidth, stadistinct, - stakind1, stakind2, stakind3, stakind4, stakind5, - staop1, staop2, staop3, staop4, staop5, - stacoll1, stacoll2, stacoll3, stacoll4, stacoll5, - stanumbers1, stanumbers2, stanumbers3, stanumbers4, stanumbers5, - stavalues1, stavalues2, stavalues3, stavalues4, stavalues5) - = (NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL) - WHERE starelid = 's0.st0'::regclass; -\i doc/export_effective_stats-14.sql.sample -/* - * If you want the statistics of per-relation or per-column, please modify - * nspname, relname, and attname in 'WHERE' clause. - */ -BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; -/* - * If you want to chage the output file name, please modify the following name. - */ -\o export_stats.dmp -COPY (SELECT n2.nspname, - cl.relname, - r.relpages, - r.reltuples, - r.relallvisible, - r.curpages, - r.last_analyze, - r.last_autoanalyze, - COALESCE(a.attname, ''), - n1.nspname AS schemaname_of_atttype, - t.typname, - a.atttypmod, - co.stainherit, - co.stanullfrac, - co.stawidth, - co.stadistinct, - co.stakind1, - co.stakind2, - co.stakind3, - co.stakind4, - co.stakind5, - co.staop1, - co.staop2, - co.staop3, - co.staop4, - co.staop5, - co.stacoll1, - co.stacoll2, - co.stacoll3, - co.stacoll4, - co.stacoll5, - co.stanumbers1, - co.stanumbers2, - co.stanumbers3, - co.stanumbers4, - co.stanumbers5, - co.stavalues1, - co.stavalues2, - co.stavalues3, - co.stavalues4, - co.stavalues5 - FROM dbms_stats.column_stats_effective co - JOIN pg_attribute a - ON (co.starelid = a.attrelid AND co.staattnum = a.attnum) - JOIN pg_type t - ON a.atttypid = t.oid - JOIN pg_namespace n1 - ON t.typnamespace = n1.oid - RIGHT JOIN dbms_stats.relation_stats_effective r - ON co.starelid = r.relid - JOIN pg_catalog.pg_class cl - ON r.relid = cl.oid - JOIN pg_catalog.pg_namespace n2 - ON cl.relnamespace = n2.oid - -- WHERE n2.nspname = 'public' - -- AND cl.relname = 'test' - -- AND a.attname = 'id' - ORDER BY starelid, staattnum) -TO STDOUT -(FORMAT 'binary'); -\o -COMMIT; -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; - nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ----------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+------------------+------------+------------------------+------------+------------ - public | pt0 | 0 | 0 | 0 | 0 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) - public | pt0_idx | 2 | 0 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) - public | st0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2} | (null) | (null) | (null) | (null) - public | st0 | 1 | 2 | 1 | 1 | name | pg_catalog | bpchar | 9 | f | 0 | 6 | -0.5 | 1 | 3 | 0 | 0 | 0 | 1054 | 1058 | 0 | 0 | 0 | 100 | 100 | 0 | 0 | 0 | {1} | {1} | (null) | (null) | (null) | {"test "} | (null) | (null) | (null) | (null) - public | st0_idx | 2 | 2 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) - public | st1 | 45 | 10000 | 45 | 45 | str | pg_catalog | text | -1 | f | -2 | -2 | -2 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | 32 | 33 | 34 | 31 | 35 | {-2,22} | {-2,23} | {-2,24} | {-2,21} | {-2,25} | (null) | (null) | {1,0,2} | (null) | (null) - public | st1 | 45 | 10000 | 45 | 45 | val | pg_catalog | int4 | -1 | f | -1 | -1 | -1 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | 32 | 33 | 34 | 31 | 35 | {-1,22} | {-1,23} | {-1,24} | {-1,21} | {-1,25} | (null) | (null) | {1,0,2} | (null) | (null) - public | st1_exp | 11 | 10000 | 0 | 11 | lower | pg_catalog | text | -1 | f | -1 | -1 | -1 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | 32 | 33 | 34 | 31 | 35 | {-1,22} | {-1,23} | {-1,24} | {-1,21} | {-1,25} | (null) | (null) | {1,0,2} | (null) | (null) - public | st1_idx | 11 | 10000 | 0 | 11 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) - s0 | sft0 | 1 | 10 | 0 | 0 | id | pg_catalog | int4 | -1 | f | -1 | -1 | -1 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | 32 | 33 | 34 | 31 | 35 | {-1,22} | {-1,23} | {-1,24} | {-1,21} | {-1,25} | (null) | (null) | {1,2,3,4,5,6,7,8,9,10} | (null) | (null) - s0 | smv0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | f | -1 | -1 | -1 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | 32 | 33 | 34 | 31 | 35 | {-1,22} | {-1,23} | {-1,24} | {-1,21} | {-1,25} | (null) | (null) | {1,2} | (null) | (null) - s0 | smv0 | 1 | 2 | 1 | 1 | num | pg_catalog | int4 | -1 | f | -2 | -2 | -2 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | 32 | 33 | 34 | 31 | 35 | {-2,22} | {-2,23} | {-2,24} | {-2,21} | {-2,25} | (null) | (null) | {10,20} | (null) | (null) - s0 | smv0 | 1 | 2 | 1 | 1 | txt | pg_catalog | text | -1 | f | -3 | -3 | -3 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | 32 | 33 | 34 | 31 | 35 | {-3,22} | {-3,23} | {-3,24} | {-3,21} | {-3,25} | (null) | (null) | {1,test} | (null) | (null) - s0 | st0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2} | (null) | (null) | (null) | (null) - s0 | st0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | t | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2,4,5,6} | (null) | (null) | (null) | (null) - s0 | st0 | 1 | 2 | 1 | 1 | num | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {10,20} | (null) | (null) | (null) | (null) - s0 | st0 | 1 | 2 | 1 | 1 | num | pg_catalog | int4 | -1 | t | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {10,20,40,50,60} | (null) | (null) | (null) | (null) - s0 | st0_idx | 2 | 2 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) - s0 | st1 | 1 | 3 | 1 | 1 | id | pg_catalog | int4 | -1 | f | -1 | -1 | -1 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | 32 | 33 | 34 | 31 | 35 | {-1,22} | {-1,23} | {-1,24} | {-1,21} | {-1,25} | (null) | (null) | {4,5,6} | (null) | (null) - s0 | st1 | 1 | 3 | 1 | 1 | num | pg_catalog | int4 | -1 | f | -2 | -2 | -2 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | 32 | 33 | 34 | 31 | 35 | {-2,22} | {-2,23} | {-2,24} | {-2,21} | {-2,25} | (null) | (null) | {40,50,60} | (null) | (null) - s0 | st1_idx | 2 | 3 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) - s0 | st2 | 1 | 3 | 1 | 1 | id | pg_catalog | int4 | -1 | f | -1 | -1 | -1 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | 32 | 33 | 34 | 31 | 35 | {-1,22} | {-1,23} | {-1,24} | {-1,21} | {-1,25} | (null) | (null) | {1,2,3} | (null) | (null) - s0 | st2 | 1 | 3 | 1 | 1 | txt | pg_catalog | text | -1 | f | -2 | -2 | -2 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | 32 | 33 | 34 | 31 | 35 | {-2,22} | {-2,23} | {-2,24} | {-2,21} | {-2,25} | (null) | (null) | {1,comment,test} | (null) | (null) - s0 | st2_idx | 2 | 3 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) - s0 | st3 | 0 | 0 | 0 | 0 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) - s1 | st0 | 1 | 4 | 1 | 1 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2,3,4} | (null) | (null) | (null) | (null) - s1 | st0 | 1 | 4 | 1 | 1 | num | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {15,25,35,45} | (null) | (null) | (null) | (null) -(27 rows) - -TRUNCATE dbms_stats.work; --- No.16-2-2 -\! sed '/ORDER/i\\ WHERE n2.nspname = '"\'s0\'" doc/export_effective_stats-14.sql.sample > doc/export_effective_stats-14.sql.sample_test -\i doc/export_effective_stats-14.sql.sample_test -/* - * If you want the statistics of per-relation or per-column, please modify - * nspname, relname, and attname in 'WHERE' clause. - */ -BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; -/* - * If you want to chage the output file name, please modify the following name. - */ -\o export_stats.dmp -COPY (SELECT n2.nspname, - cl.relname, - r.relpages, - r.reltuples, - r.relallvisible, - r.curpages, - r.last_analyze, - r.last_autoanalyze, - COALESCE(a.attname, ''), - n1.nspname AS schemaname_of_atttype, - t.typname, - a.atttypmod, - co.stainherit, - co.stanullfrac, - co.stawidth, - co.stadistinct, - co.stakind1, - co.stakind2, - co.stakind3, - co.stakind4, - co.stakind5, - co.staop1, - co.staop2, - co.staop3, - co.staop4, - co.staop5, - co.stacoll1, - co.stacoll2, - co.stacoll3, - co.stacoll4, - co.stacoll5, - co.stanumbers1, - co.stanumbers2, - co.stanumbers3, - co.stanumbers4, - co.stanumbers5, - co.stavalues1, - co.stavalues2, - co.stavalues3, - co.stavalues4, - co.stavalues5 - FROM dbms_stats.column_stats_effective co - JOIN pg_attribute a - ON (co.starelid = a.attrelid AND co.staattnum = a.attnum) - JOIN pg_type t - ON a.atttypid = t.oid - JOIN pg_namespace n1 - ON t.typnamespace = n1.oid - RIGHT JOIN dbms_stats.relation_stats_effective r - ON co.starelid = r.relid - JOIN pg_catalog.pg_class cl - ON r.relid = cl.oid - JOIN pg_catalog.pg_namespace n2 - ON cl.relnamespace = n2.oid - -- WHERE n2.nspname = 'public' - -- AND cl.relname = 'test' - -- AND a.attname = 'id' - WHERE n2.nspname = 's0' - ORDER BY starelid, staattnum) -TO STDOUT -(FORMAT 'binary'); -\o -COMMIT; -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; - nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ----------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+------------------+------------+------------------------+------------+------------ - s0 | sft0 | 1 | 10 | 0 | 0 | id | pg_catalog | int4 | -1 | f | -1 | -1 | -1 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | 32 | 33 | 34 | 31 | 35 | {-1,22} | {-1,23} | {-1,24} | {-1,21} | {-1,25} | (null) | (null) | {1,2,3,4,5,6,7,8,9,10} | (null) | (null) - s0 | smv0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | f | -1 | -1 | -1 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | 32 | 33 | 34 | 31 | 35 | {-1,22} | {-1,23} | {-1,24} | {-1,21} | {-1,25} | (null) | (null) | {1,2} | (null) | (null) - s0 | smv0 | 1 | 2 | 1 | 1 | num | pg_catalog | int4 | -1 | f | -2 | -2 | -2 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | 32 | 33 | 34 | 31 | 35 | {-2,22} | {-2,23} | {-2,24} | {-2,21} | {-2,25} | (null) | (null) | {10,20} | (null) | (null) - s0 | smv0 | 1 | 2 | 1 | 1 | txt | pg_catalog | text | -1 | f | -3 | -3 | -3 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | 32 | 33 | 34 | 31 | 35 | {-3,22} | {-3,23} | {-3,24} | {-3,21} | {-3,25} | (null) | (null) | {1,test} | (null) | (null) - s0 | st0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2} | (null) | (null) | (null) | (null) - s0 | st0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | t | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2,4,5,6} | (null) | (null) | (null) | (null) - s0 | st0 | 1 | 2 | 1 | 1 | num | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {10,20} | (null) | (null) | (null) | (null) - s0 | st0 | 1 | 2 | 1 | 1 | num | pg_catalog | int4 | -1 | t | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {10,20,40,50,60} | (null) | (null) | (null) | (null) - s0 | st0_idx | 2 | 2 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) - s0 | st1 | 1 | 3 | 1 | 1 | id | pg_catalog | int4 | -1 | f | -1 | -1 | -1 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | 32 | 33 | 34 | 31 | 35 | {-1,22} | {-1,23} | {-1,24} | {-1,21} | {-1,25} | (null) | (null) | {4,5,6} | (null) | (null) - s0 | st1 | 1 | 3 | 1 | 1 | num | pg_catalog | int4 | -1 | f | -2 | -2 | -2 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | 32 | 33 | 34 | 31 | 35 | {-2,22} | {-2,23} | {-2,24} | {-2,21} | {-2,25} | (null) | (null) | {40,50,60} | (null) | (null) - s0 | st1_idx | 2 | 3 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) - s0 | st2 | 1 | 3 | 1 | 1 | id | pg_catalog | int4 | -1 | f | -1 | -1 | -1 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | 32 | 33 | 34 | 31 | 35 | {-1,22} | {-1,23} | {-1,24} | {-1,21} | {-1,25} | (null) | (null) | {1,2,3} | (null) | (null) - s0 | st2 | 1 | 3 | 1 | 1 | txt | pg_catalog | text | -1 | f | -2 | -2 | -2 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | 32 | 33 | 34 | 31 | 35 | {-2,22} | {-2,23} | {-2,24} | {-2,21} | {-2,25} | (null) | (null) | {1,comment,test} | (null) | (null) - s0 | st2_idx | 2 | 3 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) - s0 | st3 | 0 | 0 | 0 | 0 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) -(16 rows) - -\! rm doc/export_effective_stats-14.sql.sample_test -TRUNCATE dbms_stats.work; --- No.16-2-3 -\! sed '/ORDER/i\\ WHERE cl.relname = '"\'st0\'" doc/export_effective_stats-14.sql.sample > doc/export_effective_stats-14.sql.sample_test -\i doc/export_effective_stats-14.sql.sample_test -/* - * If you want the statistics of per-relation or per-column, please modify - * nspname, relname, and attname in 'WHERE' clause. - */ -BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; -/* - * If you want to chage the output file name, please modify the following name. - */ -\o export_stats.dmp -COPY (SELECT n2.nspname, - cl.relname, - r.relpages, - r.reltuples, - r.relallvisible, - r.curpages, - r.last_analyze, - r.last_autoanalyze, - COALESCE(a.attname, ''), - n1.nspname AS schemaname_of_atttype, - t.typname, - a.atttypmod, - co.stainherit, - co.stanullfrac, - co.stawidth, - co.stadistinct, - co.stakind1, - co.stakind2, - co.stakind3, - co.stakind4, - co.stakind5, - co.staop1, - co.staop2, - co.staop3, - co.staop4, - co.staop5, - co.stacoll1, - co.stacoll2, - co.stacoll3, - co.stacoll4, - co.stacoll5, - co.stanumbers1, - co.stanumbers2, - co.stanumbers3, - co.stanumbers4, - co.stanumbers5, - co.stavalues1, - co.stavalues2, - co.stavalues3, - co.stavalues4, - co.stavalues5 - FROM dbms_stats.column_stats_effective co - JOIN pg_attribute a - ON (co.starelid = a.attrelid AND co.staattnum = a.attnum) - JOIN pg_type t - ON a.atttypid = t.oid - JOIN pg_namespace n1 - ON t.typnamespace = n1.oid - RIGHT JOIN dbms_stats.relation_stats_effective r - ON co.starelid = r.relid - JOIN pg_catalog.pg_class cl - ON r.relid = cl.oid - JOIN pg_catalog.pg_namespace n2 - ON cl.relnamespace = n2.oid - -- WHERE n2.nspname = 'public' - -- AND cl.relname = 'test' - -- AND a.attname = 'id' - WHERE cl.relname = 'st0' - ORDER BY starelid, staattnum) -TO STDOUT -(FORMAT 'binary'); -\o -COMMIT; -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; - nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ----------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+------------------+------------+------------+------------+------------ - public | st0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2} | (null) | (null) | (null) | (null) - public | st0 | 1 | 2 | 1 | 1 | name | pg_catalog | bpchar | 9 | f | 0 | 6 | -0.5 | 1 | 3 | 0 | 0 | 0 | 1054 | 1058 | 0 | 0 | 0 | 100 | 100 | 0 | 0 | 0 | {1} | {1} | (null) | (null) | (null) | {"test "} | (null) | (null) | (null) | (null) - s0 | st0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2} | (null) | (null) | (null) | (null) - s0 | st0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | t | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2,4,5,6} | (null) | (null) | (null) | (null) - s0 | st0 | 1 | 2 | 1 | 1 | num | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {10,20} | (null) | (null) | (null) | (null) - s0 | st0 | 1 | 2 | 1 | 1 | num | pg_catalog | int4 | -1 | t | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {10,20,40,50,60} | (null) | (null) | (null) | (null) - s1 | st0 | 1 | 4 | 1 | 1 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2,3,4} | (null) | (null) | (null) | (null) - s1 | st0 | 1 | 4 | 1 | 1 | num | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {15,25,35,45} | (null) | (null) | (null) | (null) -(8 rows) - -\! rm doc/export_effective_stats-14.sql.sample_test -TRUNCATE dbms_stats.work; --- No.16-2-4 -\! sed '/ORDER/i\\ WHERE cl.relname = '"\'pg_toast_1262\'" doc/export_effective_stats-14.sql.sample > doc/export_effective_stats-14.sql.sample_test -\i doc/export_effective_stats-14.sql.sample_test -/* - * If you want the statistics of per-relation or per-column, please modify - * nspname, relname, and attname in 'WHERE' clause. - */ -BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; -/* - * If you want to chage the output file name, please modify the following name. - */ -\o export_stats.dmp -COPY (SELECT n2.nspname, - cl.relname, - r.relpages, - r.reltuples, - r.relallvisible, - r.curpages, - r.last_analyze, - r.last_autoanalyze, - COALESCE(a.attname, ''), - n1.nspname AS schemaname_of_atttype, - t.typname, - a.atttypmod, - co.stainherit, - co.stanullfrac, - co.stawidth, - co.stadistinct, - co.stakind1, - co.stakind2, - co.stakind3, - co.stakind4, - co.stakind5, - co.staop1, - co.staop2, - co.staop3, - co.staop4, - co.staop5, - co.stacoll1, - co.stacoll2, - co.stacoll3, - co.stacoll4, - co.stacoll5, - co.stanumbers1, - co.stanumbers2, - co.stanumbers3, - co.stanumbers4, - co.stanumbers5, - co.stavalues1, - co.stavalues2, - co.stavalues3, - co.stavalues4, - co.stavalues5 - FROM dbms_stats.column_stats_effective co - JOIN pg_attribute a - ON (co.starelid = a.attrelid AND co.staattnum = a.attnum) - JOIN pg_type t - ON a.atttypid = t.oid - JOIN pg_namespace n1 - ON t.typnamespace = n1.oid - RIGHT JOIN dbms_stats.relation_stats_effective r - ON co.starelid = r.relid - JOIN pg_catalog.pg_class cl - ON r.relid = cl.oid - JOIN pg_catalog.pg_namespace n2 - ON cl.relnamespace = n2.oid - -- WHERE n2.nspname = 'public' - -- AND cl.relname = 'test' - -- AND a.attname = 'id' - WHERE cl.relname = 'pg_toast_1262' - ORDER BY starelid, staattnum) -TO STDOUT -(FORMAT 'binary'); -\o -COMMIT; -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; - nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ----------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------ -(0 rows) - -\! rm doc/export_effective_stats-14.sql.sample_test -TRUNCATE dbms_stats.work; --- No.16-2-5 -\! sed '/ORDER/i\\ WHERE cl.relname = '"\'st0_idx\'" doc/export_effective_stats-14.sql.sample > doc/export_effective_stats-14.sql.sample_test -\i doc/export_effective_stats-14.sql.sample_test -/* - * If you want the statistics of per-relation or per-column, please modify - * nspname, relname, and attname in 'WHERE' clause. - */ -BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; -/* - * If you want to chage the output file name, please modify the following name. - */ -\o export_stats.dmp -COPY (SELECT n2.nspname, - cl.relname, - r.relpages, - r.reltuples, - r.relallvisible, - r.curpages, - r.last_analyze, - r.last_autoanalyze, - COALESCE(a.attname, ''), - n1.nspname AS schemaname_of_atttype, - t.typname, - a.atttypmod, - co.stainherit, - co.stanullfrac, - co.stawidth, - co.stadistinct, - co.stakind1, - co.stakind2, - co.stakind3, - co.stakind4, - co.stakind5, - co.staop1, - co.staop2, - co.staop3, - co.staop4, - co.staop5, - co.stacoll1, - co.stacoll2, - co.stacoll3, - co.stacoll4, - co.stacoll5, - co.stanumbers1, - co.stanumbers2, - co.stanumbers3, - co.stanumbers4, - co.stanumbers5, - co.stavalues1, - co.stavalues2, - co.stavalues3, - co.stavalues4, - co.stavalues5 - FROM dbms_stats.column_stats_effective co - JOIN pg_attribute a - ON (co.starelid = a.attrelid AND co.staattnum = a.attnum) - JOIN pg_type t - ON a.atttypid = t.oid - JOIN pg_namespace n1 - ON t.typnamespace = n1.oid - RIGHT JOIN dbms_stats.relation_stats_effective r - ON co.starelid = r.relid - JOIN pg_catalog.pg_class cl - ON r.relid = cl.oid - JOIN pg_catalog.pg_namespace n2 - ON cl.relnamespace = n2.oid - -- WHERE n2.nspname = 'public' - -- AND cl.relname = 'test' - -- AND a.attname = 'id' - WHERE cl.relname = 'st0_idx' - ORDER BY starelid, staattnum) -TO STDOUT -(FORMAT 'binary'); -\o -COMMIT; -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; - nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ----------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------ - public | st0_idx | 2 | 2 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) - s0 | st0_idx | 2 | 2 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) -(2 rows) - -\! rm doc/export_effective_stats-14.sql.sample_test -TRUNCATE dbms_stats.work; --- No.16-2-6 -\! sed '/ORDER/i\\ WHERE cl.relname = '"\'ss0\'" doc/export_effective_stats-14.sql.sample > doc/export_effective_stats-14.sql.sample_test -\i doc/export_effective_stats-14.sql.sample_test -/* - * If you want the statistics of per-relation or per-column, please modify - * nspname, relname, and attname in 'WHERE' clause. - */ -BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; -/* - * If you want to chage the output file name, please modify the following name. - */ -\o export_stats.dmp -COPY (SELECT n2.nspname, - cl.relname, - r.relpages, - r.reltuples, - r.relallvisible, - r.curpages, - r.last_analyze, - r.last_autoanalyze, - COALESCE(a.attname, ''), - n1.nspname AS schemaname_of_atttype, - t.typname, - a.atttypmod, - co.stainherit, - co.stanullfrac, - co.stawidth, - co.stadistinct, - co.stakind1, - co.stakind2, - co.stakind3, - co.stakind4, - co.stakind5, - co.staop1, - co.staop2, - co.staop3, - co.staop4, - co.staop5, - co.stacoll1, - co.stacoll2, - co.stacoll3, - co.stacoll4, - co.stacoll5, - co.stanumbers1, - co.stanumbers2, - co.stanumbers3, - co.stanumbers4, - co.stanumbers5, - co.stavalues1, - co.stavalues2, - co.stavalues3, - co.stavalues4, - co.stavalues5 - FROM dbms_stats.column_stats_effective co - JOIN pg_attribute a - ON (co.starelid = a.attrelid AND co.staattnum = a.attnum) - JOIN pg_type t - ON a.atttypid = t.oid - JOIN pg_namespace n1 - ON t.typnamespace = n1.oid - RIGHT JOIN dbms_stats.relation_stats_effective r - ON co.starelid = r.relid - JOIN pg_catalog.pg_class cl - ON r.relid = cl.oid - JOIN pg_catalog.pg_namespace n2 - ON cl.relnamespace = n2.oid - -- WHERE n2.nspname = 'public' - -- AND cl.relname = 'test' - -- AND a.attname = 'id' - WHERE cl.relname = 'ss0' - ORDER BY starelid, staattnum) -TO STDOUT -(FORMAT 'binary'); -\o -COMMIT; -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; - nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ----------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------ -(0 rows) - -\! rm doc/export_effective_stats-14.sql.sample_test -TRUNCATE dbms_stats.work; --- No.16-2-7 -\! sed '/ORDER/i\\ WHERE cl.relname = '"\'sc0\'" doc/export_effective_stats-14.sql.sample > doc/export_effective_stats-14.sql.sample_test -\i doc/export_effective_stats-14.sql.sample_test -/* - * If you want the statistics of per-relation or per-column, please modify - * nspname, relname, and attname in 'WHERE' clause. - */ -BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; -/* - * If you want to chage the output file name, please modify the following name. - */ -\o export_stats.dmp -COPY (SELECT n2.nspname, - cl.relname, - r.relpages, - r.reltuples, - r.relallvisible, - r.curpages, - r.last_analyze, - r.last_autoanalyze, - COALESCE(a.attname, ''), - n1.nspname AS schemaname_of_atttype, - t.typname, - a.atttypmod, - co.stainherit, - co.stanullfrac, - co.stawidth, - co.stadistinct, - co.stakind1, - co.stakind2, - co.stakind3, - co.stakind4, - co.stakind5, - co.staop1, - co.staop2, - co.staop3, - co.staop4, - co.staop5, - co.stacoll1, - co.stacoll2, - co.stacoll3, - co.stacoll4, - co.stacoll5, - co.stanumbers1, - co.stanumbers2, - co.stanumbers3, - co.stanumbers4, - co.stanumbers5, - co.stavalues1, - co.stavalues2, - co.stavalues3, - co.stavalues4, - co.stavalues5 - FROM dbms_stats.column_stats_effective co - JOIN pg_attribute a - ON (co.starelid = a.attrelid AND co.staattnum = a.attnum) - JOIN pg_type t - ON a.atttypid = t.oid - JOIN pg_namespace n1 - ON t.typnamespace = n1.oid - RIGHT JOIN dbms_stats.relation_stats_effective r - ON co.starelid = r.relid - JOIN pg_catalog.pg_class cl - ON r.relid = cl.oid - JOIN pg_catalog.pg_namespace n2 - ON cl.relnamespace = n2.oid - -- WHERE n2.nspname = 'public' - -- AND cl.relname = 'test' - -- AND a.attname = 'id' - WHERE cl.relname = 'sc0' - ORDER BY starelid, staattnum) -TO STDOUT -(FORMAT 'binary'); -\o -COMMIT; -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; - nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ----------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------ -(0 rows) - -\! rm doc/export_effective_stats-14.sql.sample_test -TRUNCATE dbms_stats.work; --- No.16-2-8 -\! sed '/ORDER/i\\ WHERE cl.relname = '"\'sft0\'" doc/export_effective_stats-14.sql.sample > doc/export_effective_stats-14.sql.sample_test -\i doc/export_effective_stats-14.sql.sample_test -/* - * If you want the statistics of per-relation or per-column, please modify - * nspname, relname, and attname in 'WHERE' clause. - */ -BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; -/* - * If you want to chage the output file name, please modify the following name. - */ -\o export_stats.dmp -COPY (SELECT n2.nspname, - cl.relname, - r.relpages, - r.reltuples, - r.relallvisible, - r.curpages, - r.last_analyze, - r.last_autoanalyze, - COALESCE(a.attname, ''), - n1.nspname AS schemaname_of_atttype, - t.typname, - a.atttypmod, - co.stainherit, - co.stanullfrac, - co.stawidth, - co.stadistinct, - co.stakind1, - co.stakind2, - co.stakind3, - co.stakind4, - co.stakind5, - co.staop1, - co.staop2, - co.staop3, - co.staop4, - co.staop5, - co.stacoll1, - co.stacoll2, - co.stacoll3, - co.stacoll4, - co.stacoll5, - co.stanumbers1, - co.stanumbers2, - co.stanumbers3, - co.stanumbers4, - co.stanumbers5, - co.stavalues1, - co.stavalues2, - co.stavalues3, - co.stavalues4, - co.stavalues5 - FROM dbms_stats.column_stats_effective co - JOIN pg_attribute a - ON (co.starelid = a.attrelid AND co.staattnum = a.attnum) - JOIN pg_type t - ON a.atttypid = t.oid - JOIN pg_namespace n1 - ON t.typnamespace = n1.oid - RIGHT JOIN dbms_stats.relation_stats_effective r - ON co.starelid = r.relid - JOIN pg_catalog.pg_class cl - ON r.relid = cl.oid - JOIN pg_catalog.pg_namespace n2 - ON cl.relnamespace = n2.oid - -- WHERE n2.nspname = 'public' - -- AND cl.relname = 'test' - -- AND a.attname = 'id' - WHERE cl.relname = 'sft0' - ORDER BY starelid, staattnum) -TO STDOUT -(FORMAT 'binary'); -\o -COMMIT; -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; - nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ----------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------------------+------------+------------ - s0 | sft0 | 1 | 10 | 0 | 0 | id | pg_catalog | int4 | -1 | f | -1 | -1 | -1 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | 32 | 33 | 34 | 31 | 35 | {-1,22} | {-1,23} | {-1,24} | {-1,21} | {-1,25} | (null) | (null) | {1,2,3,4,5,6,7,8,9,10} | (null) | (null) -(1 row) - -\! rm doc/export_effective_stats-14.sql.sample_test -TRUNCATE dbms_stats.work; --- No.16-2-9 -\! sed '/ORDER/i\\ WHERE cl.relname = '"\'smv0\'" doc/export_effective_stats-14.sql.sample > doc/export_effective_stats-14.sql.sample_test -\i doc/export_effective_stats-14.sql.sample_test -/* - * If you want the statistics of per-relation or per-column, please modify - * nspname, relname, and attname in 'WHERE' clause. - */ -BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; -/* - * If you want to chage the output file name, please modify the following name. - */ -\o export_stats.dmp -COPY (SELECT n2.nspname, - cl.relname, - r.relpages, - r.reltuples, - r.relallvisible, - r.curpages, - r.last_analyze, - r.last_autoanalyze, - COALESCE(a.attname, ''), - n1.nspname AS schemaname_of_atttype, - t.typname, - a.atttypmod, - co.stainherit, - co.stanullfrac, - co.stawidth, - co.stadistinct, - co.stakind1, - co.stakind2, - co.stakind3, - co.stakind4, - co.stakind5, - co.staop1, - co.staop2, - co.staop3, - co.staop4, - co.staop5, - co.stacoll1, - co.stacoll2, - co.stacoll3, - co.stacoll4, - co.stacoll5, - co.stanumbers1, - co.stanumbers2, - co.stanumbers3, - co.stanumbers4, - co.stanumbers5, - co.stavalues1, - co.stavalues2, - co.stavalues3, - co.stavalues4, - co.stavalues5 - FROM dbms_stats.column_stats_effective co - JOIN pg_attribute a - ON (co.starelid = a.attrelid AND co.staattnum = a.attnum) - JOIN pg_type t - ON a.atttypid = t.oid - JOIN pg_namespace n1 - ON t.typnamespace = n1.oid - RIGHT JOIN dbms_stats.relation_stats_effective r - ON co.starelid = r.relid - JOIN pg_catalog.pg_class cl - ON r.relid = cl.oid - JOIN pg_catalog.pg_namespace n2 - ON cl.relnamespace = n2.oid - -- WHERE n2.nspname = 'public' - -- AND cl.relname = 'test' - -- AND a.attname = 'id' - WHERE cl.relname = 'smv0' - ORDER BY starelid, staattnum) -TO STDOUT -(FORMAT 'binary'); -\o -COMMIT; -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; - nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ----------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------ - s0 | smv0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | f | -1 | -1 | -1 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | 32 | 33 | 34 | 31 | 35 | {-1,22} | {-1,23} | {-1,24} | {-1,21} | {-1,25} | (null) | (null) | {1,2} | (null) | (null) - s0 | smv0 | 1 | 2 | 1 | 1 | num | pg_catalog | int4 | -1 | f | -2 | -2 | -2 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | 32 | 33 | 34 | 31 | 35 | {-2,22} | {-2,23} | {-2,24} | {-2,21} | {-2,25} | (null) | (null) | {10,20} | (null) | (null) - s0 | smv0 | 1 | 2 | 1 | 1 | txt | pg_catalog | text | -1 | f | -3 | -3 | -3 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | 32 | 33 | 34 | 31 | 35 | {-3,22} | {-3,23} | {-3,24} | {-3,21} | {-3,25} | (null) | (null) | {1,test} | (null) | (null) -(3 rows) - -\! rm doc/export_effective_stats-14.sql.sample_test -TRUNCATE dbms_stats.work; --- No.16-2-10 -\! sed '/ORDER/i\\ WHERE n2.nspname = '"\'s0\'"' AND a.attname = '"\'id\'" doc/export_effective_stats-14.sql.sample > doc/export_effective_stats-14.sql.sample_test -\i doc/export_effective_stats-14.sql.sample_test -/* - * If you want the statistics of per-relation or per-column, please modify - * nspname, relname, and attname in 'WHERE' clause. - */ -BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; -/* - * If you want to chage the output file name, please modify the following name. - */ -\o export_stats.dmp -COPY (SELECT n2.nspname, - cl.relname, - r.relpages, - r.reltuples, - r.relallvisible, - r.curpages, - r.last_analyze, - r.last_autoanalyze, - COALESCE(a.attname, ''), - n1.nspname AS schemaname_of_atttype, - t.typname, - a.atttypmod, - co.stainherit, - co.stanullfrac, - co.stawidth, - co.stadistinct, - co.stakind1, - co.stakind2, - co.stakind3, - co.stakind4, - co.stakind5, - co.staop1, - co.staop2, - co.staop3, - co.staop4, - co.staop5, - co.stacoll1, - co.stacoll2, - co.stacoll3, - co.stacoll4, - co.stacoll5, - co.stanumbers1, - co.stanumbers2, - co.stanumbers3, - co.stanumbers4, - co.stanumbers5, - co.stavalues1, - co.stavalues2, - co.stavalues3, - co.stavalues4, - co.stavalues5 - FROM dbms_stats.column_stats_effective co - JOIN pg_attribute a - ON (co.starelid = a.attrelid AND co.staattnum = a.attnum) - JOIN pg_type t - ON a.atttypid = t.oid - JOIN pg_namespace n1 - ON t.typnamespace = n1.oid - RIGHT JOIN dbms_stats.relation_stats_effective r - ON co.starelid = r.relid - JOIN pg_catalog.pg_class cl - ON r.relid = cl.oid - JOIN pg_catalog.pg_namespace n2 - ON cl.relnamespace = n2.oid - -- WHERE n2.nspname = 'public' - -- AND cl.relname = 'test' - -- AND a.attname = 'id' - WHERE n2.nspname = 's0' AND a.attname = 'id' - ORDER BY starelid, staattnum) -TO STDOUT -(FORMAT 'binary'); -\o -COMMIT; -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; - nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ----------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+-------------+------------+------------------------+------------+------------ - s0 | sft0 | 1 | 10 | 0 | 0 | id | pg_catalog | int4 | -1 | f | -1 | -1 | -1 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | 32 | 33 | 34 | 31 | 35 | {-1,22} | {-1,23} | {-1,24} | {-1,21} | {-1,25} | (null) | (null) | {1,2,3,4,5,6,7,8,9,10} | (null) | (null) - s0 | smv0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | f | -1 | -1 | -1 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | 32 | 33 | 34 | 31 | 35 | {-1,22} | {-1,23} | {-1,24} | {-1,21} | {-1,25} | (null) | (null) | {1,2} | (null) | (null) - s0 | st0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2} | (null) | (null) | (null) | (null) - s0 | st0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | t | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2,4,5,6} | (null) | (null) | (null) | (null) - s0 | st1 | 1 | 3 | 1 | 1 | id | pg_catalog | int4 | -1 | f | -1 | -1 | -1 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | 32 | 33 | 34 | 31 | 35 | {-1,22} | {-1,23} | {-1,24} | {-1,21} | {-1,25} | (null) | (null) | {4,5,6} | (null) | (null) - s0 | st2 | 1 | 3 | 1 | 1 | id | pg_catalog | int4 | -1 | f | -1 | -1 | -1 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | 32 | 33 | 34 | 31 | 35 | {-1,22} | {-1,23} | {-1,24} | {-1,21} | {-1,25} | (null) | (null) | {1,2,3} | (null) | (null) -(6 rows) - -\! rm doc/export_effective_stats-14.sql.sample_test -TRUNCATE dbms_stats.work; --- No.16-2-11 -\! sed '/ORDER/i\\ WHERE n2.nspname = '"\'s0\'"' AND a.attname IS NULL' doc/export_effective_stats-14.sql.sample > doc/export_effective_stats-14.sql.sample_test -\i doc/export_effective_stats-14.sql.sample_test -/* - * If you want the statistics of per-relation or per-column, please modify - * nspname, relname, and attname in 'WHERE' clause. - */ -BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; -/* - * If you want to chage the output file name, please modify the following name. - */ -\o export_stats.dmp -COPY (SELECT n2.nspname, - cl.relname, - r.relpages, - r.reltuples, - r.relallvisible, - r.curpages, - r.last_analyze, - r.last_autoanalyze, - COALESCE(a.attname, ''), - n1.nspname AS schemaname_of_atttype, - t.typname, - a.atttypmod, - co.stainherit, - co.stanullfrac, - co.stawidth, - co.stadistinct, - co.stakind1, - co.stakind2, - co.stakind3, - co.stakind4, - co.stakind5, - co.staop1, - co.staop2, - co.staop3, - co.staop4, - co.staop5, - co.stacoll1, - co.stacoll2, - co.stacoll3, - co.stacoll4, - co.stacoll5, - co.stanumbers1, - co.stanumbers2, - co.stanumbers3, - co.stanumbers4, - co.stanumbers5, - co.stavalues1, - co.stavalues2, - co.stavalues3, - co.stavalues4, - co.stavalues5 - FROM dbms_stats.column_stats_effective co - JOIN pg_attribute a - ON (co.starelid = a.attrelid AND co.staattnum = a.attnum) - JOIN pg_type t - ON a.atttypid = t.oid - JOIN pg_namespace n1 - ON t.typnamespace = n1.oid - RIGHT JOIN dbms_stats.relation_stats_effective r - ON co.starelid = r.relid - JOIN pg_catalog.pg_class cl - ON r.relid = cl.oid - JOIN pg_catalog.pg_namespace n2 - ON cl.relnamespace = n2.oid - -- WHERE n2.nspname = 'public' - -- AND cl.relname = 'test' - -- AND a.attname = 'id' - WHERE n2.nspname = 's0' AND a.attname IS NULL - ORDER BY starelid, staattnum) -TO STDOUT -(FORMAT 'binary'); -\o -COMMIT; -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; - nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ----------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------ - s0 | st0_idx | 2 | 2 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) - s0 | st1_idx | 2 | 3 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) - s0 | st2_idx | 2 | 3 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) - s0 | st3 | 0 | 0 | 0 | 0 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) -(4 rows) - -\! rm doc/export_effective_stats-14.sql.sample_test -TRUNCATE dbms_stats.work; --- No.16-2-12 -\! sed '/ORDER/i\\ WHERE n2.nspname = '"\'s0\'"' AND cl.relname IS NULL' doc/export_effective_stats-14.sql.sample > doc/export_effective_stats-14.sql.sample_test -\i doc/export_effective_stats-14.sql.sample_test -/* - * If you want the statistics of per-relation or per-column, please modify - * nspname, relname, and attname in 'WHERE' clause. - */ -BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; -/* - * If you want to chage the output file name, please modify the following name. - */ -\o export_stats.dmp -COPY (SELECT n2.nspname, - cl.relname, - r.relpages, - r.reltuples, - r.relallvisible, - r.curpages, - r.last_analyze, - r.last_autoanalyze, - COALESCE(a.attname, ''), - n1.nspname AS schemaname_of_atttype, - t.typname, - a.atttypmod, - co.stainherit, - co.stanullfrac, - co.stawidth, - co.stadistinct, - co.stakind1, - co.stakind2, - co.stakind3, - co.stakind4, - co.stakind5, - co.staop1, - co.staop2, - co.staop3, - co.staop4, - co.staop5, - co.stacoll1, - co.stacoll2, - co.stacoll3, - co.stacoll4, - co.stacoll5, - co.stanumbers1, - co.stanumbers2, - co.stanumbers3, - co.stanumbers4, - co.stanumbers5, - co.stavalues1, - co.stavalues2, - co.stavalues3, - co.stavalues4, - co.stavalues5 - FROM dbms_stats.column_stats_effective co - JOIN pg_attribute a - ON (co.starelid = a.attrelid AND co.staattnum = a.attnum) - JOIN pg_type t - ON a.atttypid = t.oid - JOIN pg_namespace n1 - ON t.typnamespace = n1.oid - RIGHT JOIN dbms_stats.relation_stats_effective r - ON co.starelid = r.relid - JOIN pg_catalog.pg_class cl - ON r.relid = cl.oid - JOIN pg_catalog.pg_namespace n2 - ON cl.relnamespace = n2.oid - -- WHERE n2.nspname = 'public' - -- AND cl.relname = 'test' - -- AND a.attname = 'id' - WHERE n2.nspname = 's0' AND cl.relname IS NULL - ORDER BY starelid, staattnum) -TO STDOUT -(FORMAT 'binary'); -\o -COMMIT; -COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary'); -SELECT * FROM work_v; - nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stacoll1 | stacoll2 | stacoll3 | stacoll4 | stacoll5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 ----------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+----------+----------+----------+----------+----------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------ -(0 rows) - -\! rm doc/export_effective_stats-14.sql.sample_test -TRUNCATE dbms_stats.work; -/* - * Stab function dbms_stats.import - */ -ALTER FUNCTION dbms_stats.import( - nspname text, - relid regclass, - attname text, - src text -) RENAME TO truth_import; -CREATE FUNCTION dbms_stats.import( - nspname text, - relid regclass, - attname text, - src text -) RETURNS void AS -$$ -BEGIN - RAISE NOTICE 'arguments are "%", "%", "%", "%"', $1, $2, $3, $4; - RETURN; -END -$$ -LANGUAGE plpgsql; -/* - * No.17-1 dbms_stats.import_database_stats(src) - */ --- No.17-1-1 -SELECT dbms_stats.import_database_stats('@abs_srcdir@/export_stats.dmp'); -NOTICE: arguments are "", "", "", "@abs_srcdir@/export_stats.dmp" - import_database_stats ------------------------ - -(1 row) - -/* - * No.17-2 dbms_stats.import_schema_stats(schemaname, src) - */ --- No.17-2-1 -SELECT dbms_stats.import_schema_stats('s0', '@abs_srcdir@/export_stats.dmp'); -NOTICE: arguments are "s0", "", "", "@abs_srcdir@/export_stats.dmp" - import_schema_stats ---------------------- - -(1 row) - -/* - * No.17-3 dbms_stats.import_table_stats(relid, src) - */ --- No.17-3-1 -SELECT dbms_stats.import_table_stats('s0.st0', '@abs_srcdir@/export_stats.dmp'); -NOTICE: arguments are "", "s0.st0", "", "@abs_srcdir@/export_stats.dmp" - import_table_stats --------------------- - -(1 row) - -/* - * No.17-4 dbms_stats.import_table_stats(schemaname, tablename, src) - */ --- No.17-4-1 -SELECT dbms_stats.import_table_stats('s0', 'st0', '@abs_srcdir@/export_stats.dmp'); -NOTICE: arguments are "", "s0.st0", "", "@abs_srcdir@/export_stats.dmp" - import_table_stats --------------------- - -(1 row) - -/* - * No.17-5 dbms_stats.import_column_stats (relid, attname, src) - */ --- No.17-5-1 -SELECT dbms_stats.import_column_stats('s0.st0', 'id', '@abs_srcdir@/export_stats.dmp'); -NOTICE: arguments are "", "s0.st0", "id", "@abs_srcdir@/export_stats.dmp" - import_column_stats ---------------------- - -(1 row) - -/* - * No.17-6 dbms_stats.import_column_stats (schemaname, tablename, attname, src) - */ --- No.17-6-1 -SELECT dbms_stats.import_column_stats('s0', 'st0', 'id','@abs_srcdir@/export_stats.dmp'); -NOTICE: arguments are "", "s0.st0", "id", "@abs_srcdir@/export_stats.dmp" - import_column_stats ---------------------- - -(1 row) - -/* - * Delete stab function dbms_stats.import - */ -DROP FUNCTION dbms_stats.import( - nspname text, - relid regclass, - attname text, - src text -); -ALTER FUNCTION dbms_stats.truth_import( - nspname text, - relid regclass, - attname text, - src text -) RENAME TO import; diff --git a/sql/.gitignore b/sql/.gitignore index e144140..98f0630 100644 --- a/sql/.gitignore +++ b/sql/.gitignore @@ -1,3 +1 @@ /ut_anyarray-*.sql -/ut_imp_exp-*.sql -/ut_fdw_init.sql diff --git a/output/ut_fdw_init.source b/sql/ut_fdw_init.sql similarity index 50% rename from output/ut_fdw_init.source rename to sql/ut_fdw_init.sql index 5b2d375..65cec0d 100644 --- a/output/ut_fdw_init.source +++ b/sql/ut_fdw_init.sql @@ -1,8 +1,11 @@ +\getenv abs_srcdir PG_ABS_SRCDIR +\set csv_path :abs_srcdir '/ut-fdw.csv' + CREATE EXTENSION file_fdw; CREATE SERVER test_server FOREIGN DATA WRAPPER file_fdw; CREATE FOREIGN TABLE s0.sft0(id integer) SERVER test_server - OPTIONS (filename '@abs_srcdir@/ut-fdw.csv', + OPTIONS (filename :'csv_path', format 'csv'); -\! cp @abs_srcdir@/input/ut-fdw.csv @abs_srcdir@/ut-fdw.csv +\! cp $PG_ABS_SRCDIR/input/ut-fdw.csv $PG_ABS_SRCDIR/ut-fdw.csv diff --git a/sql/ut_imp_exp.sql b/sql/ut_imp_exp.sql index 3a1bd3c..fa25f92 100644 --- a/sql/ut_imp_exp.sql +++ b/sql/ut_imp_exp.sql @@ -1,7 +1,9 @@ +\getenv abs_srcdir PG_ABS_SRCDIR +\set dump_path :abs_srcdir '/export_stats.dmp' \pset null '(null)' CREATE TABLE s0.st3(); /* - * No.16-1 export_plain_stats-14.sql.sample + * No.16-1 export_plain_stats-15.sql.sample */ -- No.16-1-1 ANALYZE; @@ -39,92 +41,92 @@ UPDATE dbms_stats.column_stats_locked SET stavalues3 = stavalues1, stavalues4 = stavalues4, stavalues5 = stavalues5; -\i doc/export_plain_stats-14.sql.sample -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +\i doc/export_plain_stats-15.sql.sample +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; TRUNCATE dbms_stats.work; -- No.16-1-2 -\! sed '/ORDER/i\\ AND n2.nspname = '"\'s0\'" doc/export_plain_stats-14.sql.sample > doc/export_plain_stats-14.sql.sample_test -\i doc/export_plain_stats-14.sql.sample_test -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +\! sed '/ORDER/i\\ AND n2.nspname = '"\'s0\'" doc/export_plain_stats-15.sql.sample > doc/export_plain_stats-15.sql.sample_test +\i doc/export_plain_stats-15.sql.sample_test +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; TRUNCATE dbms_stats.work; -\! rm doc/export_plain_stats-14.sql.sample_test +\! rm doc/export_plain_stats-15.sql.sample_test -- No.16-1-3 -\! sed '/ORDER/i\\ AND c.relname = '"\'st0\'" doc/export_plain_stats-14.sql.sample > doc/export_plain_stats-14.sql.sample_test -\i doc/export_plain_stats-14.sql.sample_test -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +\! sed '/ORDER/i\\ AND c.relname = '"\'st0\'" doc/export_plain_stats-15.sql.sample > doc/export_plain_stats-15.sql.sample_test +\i doc/export_plain_stats-15.sql.sample_test +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; TRUNCATE dbms_stats.work; -\! rm doc/export_plain_stats-14.sql.sample_test +\! rm doc/export_plain_stats-15.sql.sample_test -- No.16-1-3-1 Actual import test -select dbms_stats.import_database_stats('/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp'); +select dbms_stats.import_database_stats(:'dump_path'); -- No.16-1-4 -\! sed '/ORDER/i\\ AND c.relname = '"\'pg_toast_1262\'" doc/export_plain_stats-14.sql.sample > doc/export_plain_stats-14.sql.sample_test -\i doc/export_plain_stats-14.sql.sample_test -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +\! sed '/ORDER/i\\ AND c.relname = '"\'pg_toast_1262\'" doc/export_plain_stats-15.sql.sample > doc/export_plain_stats-15.sql.sample_test +\i doc/export_plain_stats-15.sql.sample_test +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; TRUNCATE dbms_stats.work; -\! rm doc/export_plain_stats-14.sql.sample_test +\! rm doc/export_plain_stats-15.sql.sample_test -- No.16-1-5 -\! sed '/ORDER/i\\ AND c.relname = '"\'st0_idx\'" doc/export_plain_stats-14.sql.sample > doc/export_plain_stats-14.sql.sample_test -\i doc/export_plain_stats-14.sql.sample_test -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +\! sed '/ORDER/i\\ AND c.relname = '"\'st0_idx\'" doc/export_plain_stats-15.sql.sample > doc/export_plain_stats-15.sql.sample_test +\i doc/export_plain_stats-15.sql.sample_test +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; TRUNCATE dbms_stats.work; -\! rm doc/export_plain_stats-14.sql.sample_test +\! rm doc/export_plain_stats-15.sql.sample_test -- No.16-1-6 -\! sed '/ORDER/i\\ AND c.relname = '"\'ss0\'" doc/export_plain_stats-14.sql.sample > doc/export_plain_stats-14.sql.sample_test -\i doc/export_plain_stats-14.sql.sample_test -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +\! sed '/ORDER/i\\ AND c.relname = '"\'ss0\'" doc/export_plain_stats-15.sql.sample > doc/export_plain_stats-15.sql.sample_test +\i doc/export_plain_stats-15.sql.sample_test +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; TRUNCATE dbms_stats.work; -\! rm doc/export_plain_stats-14.sql.sample_test +\! rm doc/export_plain_stats-15.sql.sample_test -- No.16-1-7 -\! sed '/ORDER/i\\ AND c.relname = '"\'sc0\'" doc/export_plain_stats-14.sql.sample > doc/export_plain_stats-14.sql.sample_test -\i doc/export_plain_stats-14.sql.sample_test -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +\! sed '/ORDER/i\\ AND c.relname = '"\'sc0\'" doc/export_plain_stats-15.sql.sample > doc/export_plain_stats-15.sql.sample_test +\i doc/export_plain_stats-15.sql.sample_test +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; TRUNCATE dbms_stats.work; -\! rm doc/export_plain_stats-14.sql.sample_test +\! rm doc/export_plain_stats-15.sql.sample_test -- No.16-1-8 -\! sed '/ORDER/i\\ AND c.relname = '"\'sft0\'" doc/export_plain_stats-14.sql.sample > doc/export_plain_stats-14.sql.sample_test -\i doc/export_plain_stats-14.sql.sample_test -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +\! sed '/ORDER/i\\ AND c.relname = '"\'sft0\'" doc/export_plain_stats-15.sql.sample > doc/export_plain_stats-15.sql.sample_test +\i doc/export_plain_stats-15.sql.sample_test +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; TRUNCATE dbms_stats.work; -\! rm doc/export_plain_stats-14.sql.sample_test +\! rm doc/export_plain_stats-15.sql.sample_test -- No.16-1-9 -\! sed '/ORDER/i\\ AND c.relname = '"\'smv0\'" doc/export_plain_stats-14.sql.sample > doc/export_plain_stats-14.sql.sample_test -\i doc/export_plain_stats-14.sql.sample_test -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +\! sed '/ORDER/i\\ AND c.relname = '"\'smv0\'" doc/export_plain_stats-15.sql.sample > doc/export_plain_stats-15.sql.sample_test +\i doc/export_plain_stats-15.sql.sample_test +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; TRUNCATE dbms_stats.work; -\! rm doc/export_plain_stats-14.sql.sample_test +\! rm doc/export_plain_stats-15.sql.sample_test -- No.16-1-10 -\! sed '/ORDER/i\\ AND n2.nspname = '"\'s0\'"' AND a.attname = '\'id\' doc/export_plain_stats-14.sql.sample > doc/export_plain_stats-14.sql.sample_test -\i doc/export_plain_stats-14.sql.sample_test -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +\! sed '/ORDER/i\\ AND n2.nspname = '"\'s0\'"' AND a.attname = '\'id\' doc/export_plain_stats-15.sql.sample > doc/export_plain_stats-15.sql.sample_test +\i doc/export_plain_stats-15.sql.sample_test +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; TRUNCATE dbms_stats.work; -\! rm doc/export_plain_stats-14.sql.sample_test +\! rm doc/export_plain_stats-15.sql.sample_test -- No.16-1-11 -\! sed '/ORDER/i\\ AND n2.nspname = '"\'s0\'"' AND a.attname IS NULL' doc/export_plain_stats-14.sql.sample > doc/export_plain_stats-14.sql.sample_test -\i doc/export_plain_stats-14.sql.sample_test -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +\! sed '/ORDER/i\\ AND n2.nspname = '"\'s0\'"' AND a.attname IS NULL' doc/export_plain_stats-15.sql.sample > doc/export_plain_stats-15.sql.sample_test +\i doc/export_plain_stats-15.sql.sample_test +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; TRUNCATE dbms_stats.work; -\! rm doc/export_plain_stats-14.sql.sample_test +\! rm doc/export_plain_stats-15.sql.sample_test -- No.16-1-12 -\! sed '/ORDER/i\\ AND n2.nspname = '"\'s1\'"' AND c.relname IS NULL' doc/export_plain_stats-14.sql.sample > doc/export_plain_stats-14.sql.sample_test -\i doc/export_plain_stats-14.sql.sample_test -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +\! sed '/ORDER/i\\ AND n2.nspname = '"\'s1\'"' AND c.relname IS NULL' doc/export_plain_stats-15.sql.sample > doc/export_plain_stats-15.sql.sample_test +\i doc/export_plain_stats-15.sql.sample_test +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; TRUNCATE dbms_stats.work; -\! rm doc/export_plain_stats-14.sql.sample_test +\! rm doc/export_plain_stats-15.sql.sample_test /* - * No.16-2 export_effective_stats-14.sql.sample + * No.16-2 export_effective_stats-15.sql.sample */ -- No.16-2-1 VACUUM ANALYZE; @@ -145,86 +147,86 @@ UPDATE dbms_stats.column_stats_locked NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) WHERE starelid = 's0.st0'::regclass; -\i doc/export_effective_stats-14.sql.sample -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +\i doc/export_effective_stats-15.sql.sample +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; TRUNCATE dbms_stats.work; -- No.16-2-2 -\! sed '/ORDER/i\\ WHERE n2.nspname = '"\'s0\'" doc/export_effective_stats-14.sql.sample > doc/export_effective_stats-14.sql.sample_test -\i doc/export_effective_stats-14.sql.sample_test -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +\! sed '/ORDER/i\\ WHERE n2.nspname = '"\'s0\'" doc/export_effective_stats-15.sql.sample > doc/export_effective_stats-15.sql.sample_test +\i doc/export_effective_stats-15.sql.sample_test +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; -\! rm doc/export_effective_stats-14.sql.sample_test +\! rm doc/export_effective_stats-15.sql.sample_test TRUNCATE dbms_stats.work; -- No.16-2-3 -\! sed '/ORDER/i\\ WHERE cl.relname = '"\'st0\'" doc/export_effective_stats-14.sql.sample > doc/export_effective_stats-14.sql.sample_test -\i doc/export_effective_stats-14.sql.sample_test -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +\! sed '/ORDER/i\\ WHERE cl.relname = '"\'st0\'" doc/export_effective_stats-15.sql.sample > doc/export_effective_stats-15.sql.sample_test +\i doc/export_effective_stats-15.sql.sample_test +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; -\! rm doc/export_effective_stats-14.sql.sample_test +\! rm doc/export_effective_stats-15.sql.sample_test TRUNCATE dbms_stats.work; -- No.16-2-4 -\! sed '/ORDER/i\\ WHERE cl.relname = '"\'pg_toast_1262\'" doc/export_effective_stats-14.sql.sample > doc/export_effective_stats-14.sql.sample_test -\i doc/export_effective_stats-14.sql.sample_test -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +\! sed '/ORDER/i\\ WHERE cl.relname = '"\'pg_toast_1262\'" doc/export_effective_stats-15.sql.sample > doc/export_effective_stats-15.sql.sample_test +\i doc/export_effective_stats-15.sql.sample_test +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; -\! rm doc/export_effective_stats-14.sql.sample_test +\! rm doc/export_effective_stats-15.sql.sample_test TRUNCATE dbms_stats.work; -- No.16-2-5 -\! sed '/ORDER/i\\ WHERE cl.relname = '"\'st0_idx\'" doc/export_effective_stats-14.sql.sample > doc/export_effective_stats-14.sql.sample_test -\i doc/export_effective_stats-14.sql.sample_test -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +\! sed '/ORDER/i\\ WHERE cl.relname = '"\'st0_idx\'" doc/export_effective_stats-15.sql.sample > doc/export_effective_stats-15.sql.sample_test +\i doc/export_effective_stats-15.sql.sample_test +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; -\! rm doc/export_effective_stats-14.sql.sample_test +\! rm doc/export_effective_stats-15.sql.sample_test TRUNCATE dbms_stats.work; -- No.16-2-6 -\! sed '/ORDER/i\\ WHERE cl.relname = '"\'ss0\'" doc/export_effective_stats-14.sql.sample > doc/export_effective_stats-14.sql.sample_test -\i doc/export_effective_stats-14.sql.sample_test -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +\! sed '/ORDER/i\\ WHERE cl.relname = '"\'ss0\'" doc/export_effective_stats-15.sql.sample > doc/export_effective_stats-15.sql.sample_test +\i doc/export_effective_stats-15.sql.sample_test +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; -\! rm doc/export_effective_stats-14.sql.sample_test +\! rm doc/export_effective_stats-15.sql.sample_test TRUNCATE dbms_stats.work; -- No.16-2-7 -\! sed '/ORDER/i\\ WHERE cl.relname = '"\'sc0\'" doc/export_effective_stats-14.sql.sample > doc/export_effective_stats-14.sql.sample_test -\i doc/export_effective_stats-14.sql.sample_test -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +\! sed '/ORDER/i\\ WHERE cl.relname = '"\'sc0\'" doc/export_effective_stats-15.sql.sample > doc/export_effective_stats-15.sql.sample_test +\i doc/export_effective_stats-15.sql.sample_test +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; -\! rm doc/export_effective_stats-14.sql.sample_test +\! rm doc/export_effective_stats-15.sql.sample_test TRUNCATE dbms_stats.work; -- No.16-2-8 -\! sed '/ORDER/i\\ WHERE cl.relname = '"\'sft0\'" doc/export_effective_stats-14.sql.sample > doc/export_effective_stats-14.sql.sample_test -\i doc/export_effective_stats-14.sql.sample_test -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +\! sed '/ORDER/i\\ WHERE cl.relname = '"\'sft0\'" doc/export_effective_stats-15.sql.sample > doc/export_effective_stats-15.sql.sample_test +\i doc/export_effective_stats-15.sql.sample_test +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; -\! rm doc/export_effective_stats-14.sql.sample_test +\! rm doc/export_effective_stats-15.sql.sample_test TRUNCATE dbms_stats.work; -- No.16-2-9 -\! sed '/ORDER/i\\ WHERE cl.relname = '"\'smv0\'" doc/export_effective_stats-14.sql.sample > doc/export_effective_stats-14.sql.sample_test -\i doc/export_effective_stats-14.sql.sample_test -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +\! sed '/ORDER/i\\ WHERE cl.relname = '"\'smv0\'" doc/export_effective_stats-15.sql.sample > doc/export_effective_stats-15.sql.sample_test +\i doc/export_effective_stats-15.sql.sample_test +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; -\! rm doc/export_effective_stats-14.sql.sample_test +\! rm doc/export_effective_stats-15.sql.sample_test TRUNCATE dbms_stats.work; -- No.16-2-10 -\! sed '/ORDER/i\\ WHERE n2.nspname = '"\'s0\'"' AND a.attname = '"\'id\'" doc/export_effective_stats-14.sql.sample > doc/export_effective_stats-14.sql.sample_test -\i doc/export_effective_stats-14.sql.sample_test -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +\! sed '/ORDER/i\\ WHERE n2.nspname = '"\'s0\'"' AND a.attname = '"\'id\'" doc/export_effective_stats-15.sql.sample > doc/export_effective_stats-15.sql.sample_test +\i doc/export_effective_stats-15.sql.sample_test +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; -\! rm doc/export_effective_stats-14.sql.sample_test +\! rm doc/export_effective_stats-15.sql.sample_test TRUNCATE dbms_stats.work; -- No.16-2-11 -\! sed '/ORDER/i\\ WHERE n2.nspname = '"\'s0\'"' AND a.attname IS NULL' doc/export_effective_stats-14.sql.sample > doc/export_effective_stats-14.sql.sample_test -\i doc/export_effective_stats-14.sql.sample_test -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +\! sed '/ORDER/i\\ WHERE n2.nspname = '"\'s0\'"' AND a.attname IS NULL' doc/export_effective_stats-15.sql.sample > doc/export_effective_stats-15.sql.sample_test +\i doc/export_effective_stats-15.sql.sample_test +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; -\! rm doc/export_effective_stats-14.sql.sample_test +\! rm doc/export_effective_stats-15.sql.sample_test TRUNCATE dbms_stats.work; -- No.16-2-12 -\! sed '/ORDER/i\\ WHERE n2.nspname = '"\'s0\'"' AND cl.relname IS NULL' doc/export_effective_stats-14.sql.sample > doc/export_effective_stats-14.sql.sample_test -\i doc/export_effective_stats-14.sql.sample_test -COPY dbms_stats.work FROM '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp' (FORMAT 'binary'); +\! sed '/ORDER/i\\ WHERE n2.nspname = '"\'s0\'"' AND cl.relname IS NULL' doc/export_effective_stats-15.sql.sample > doc/export_effective_stats-15.sql.sample_test +\i doc/export_effective_stats-15.sql.sample_test +COPY dbms_stats.work FROM :'dump_path' (FORMAT 'binary'); SELECT * FROM work_v; -\! rm doc/export_effective_stats-14.sql.sample_test +\! rm doc/export_effective_stats-15.sql.sample_test TRUNCATE dbms_stats.work; /* @@ -253,37 +255,37 @@ LANGUAGE plpgsql; * No.17-1 dbms_stats.import_database_stats(src) */ -- No.17-1-1 -SELECT dbms_stats.import_database_stats('/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp'); +SELECT dbms_stats.import_database_stats('export_stats.dmp'); /* * No.17-2 dbms_stats.import_schema_stats(schemaname, src) */ -- No.17-2-1 -SELECT dbms_stats.import_schema_stats('s0', '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp'); +SELECT dbms_stats.import_schema_stats('s0', 'export_stats.dmp'); /* * No.17-3 dbms_stats.import_table_stats(relid, src) */ -- No.17-3-1 -SELECT dbms_stats.import_table_stats('s0.st0', '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp'); +SELECT dbms_stats.import_table_stats('s0.st0', 'export_stats.dmp'); /* * No.17-4 dbms_stats.import_table_stats(schemaname, tablename, src) */ -- No.17-4-1 -SELECT dbms_stats.import_table_stats('s0', 'st0', '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp'); +SELECT dbms_stats.import_table_stats('s0', 'st0', 'export_stats.dmp'); /* * No.17-5 dbms_stats.import_column_stats (relid, attname, src) */ -- No.17-5-1 -SELECT dbms_stats.import_column_stats('s0.st0', 'id', '/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp'); +SELECT dbms_stats.import_column_stats('s0.st0', 'id', 'export_stats.dmp'); /* * No.17-6 dbms_stats.import_column_stats (schemaname, tablename, attname, src) */ -- No.17-6-1 -SELECT dbms_stats.import_column_stats('s0', 'st0', 'id','/home/postgres/git_repos/internal/pg_dbms_stats/export_stats.dmp'); +SELECT dbms_stats.import_column_stats('s0', 'st0', 'id', 'export_stats.dmp'); /* * Delete stab function dbms_stats.import From 6f6dd10b46ca87ea730f53a0d772dd8f356470c5 Mon Sep 17 00:00:00 2001 From: Alexey Makhmutov Date: Tue, 21 Feb 2023 16:23:01 +0300 Subject: [PATCH 3/6] Fix missing space at the end of a numeric literal in a dbms_stats_import query --- import.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/import.c b/import.c index 274a528..7031d3f 100644 --- a/import.c +++ b/import.c @@ -251,7 +251,7 @@ dbms_stats_import(PG_FUNCTION_ARGS) "ON (w.nspname = cn.nspname AND w.relname = c.relname " "AND (w.attname = a.attname OR w.attname = '')) " "WHERE w.nspname = $1 AND w.relname = $2 " - "AND a.attnum > 0" + "AND a.attnum > 0 " "ORDER BY 1, 3, 2", 2, r_types, &c_sel_plan, values, NULL, SPI_OK_SELECT); From 515b966dd7608f2e403325297165cc8b3ed15765 Mon Sep 17 00:00:00 2001 From: Alexey Makhmutov Date: Tue, 21 Feb 2023 17:19:37 +0300 Subject: [PATCH 4/6] Increase sleep interval to 1.2s from 0.7s to reflect change of minimal pg_stat update interval in PG15 to 1000 ms from 500 ms --- expected/ut-common.out | 28 ++++++++++++++-------------- sql/ut-common.sql | 28 ++++++++++++++-------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/expected/ut-common.out b/expected/ut-common.out index 910781f..05ae864 100644 --- a/expected/ut-common.out +++ b/expected/ut-common.out @@ -643,7 +643,7 @@ SELECT relname, curpages FROM dbms_stats.relation_stats_locked public.st1 | 45 (1 row) -SELECT pg_sleep(0.7); +SELECT pg_sleep(1.2); pg_sleep ---------- @@ -664,7 +664,7 @@ SELECT pg_stat_reset(); VACUUM ANALYZE; UPDATE dbms_stats.relation_stats_locked SET curpages = 1000 WHERE relid = 'st1_exp'::regclass; -SELECT pg_sleep(0.7); +SELECT pg_sleep(1.2); pg_sleep ---------- @@ -696,7 +696,7 @@ SELECT relname, curpages FROM dbms_stats.relation_stats_locked public.st1 | 45 (1 row) -SELECT pg_sleep(0.7); +SELECT pg_sleep(1.2); pg_sleep ---------- @@ -820,7 +820,7 @@ SELECT * FROM s0.droptest 1 (1 row) -SELECT pg_sleep(0.7); +SELECT pg_sleep(1.2); pg_sleep ---------- @@ -839,7 +839,7 @@ SELECT pg_stat_reset(); (1 row) ALTER TABLE s0.droptest RENAME TO test; -SELECT pg_sleep(0.7); +SELECT pg_sleep(1.2); pg_sleep ---------- @@ -871,7 +871,7 @@ SELECT * FROM s0.test 1 (1 row) -SELECT pg_sleep(0.7); +SELECT pg_sleep(1.2); pg_sleep ---------- @@ -894,7 +894,7 @@ SELECT * FROM s0.droptest 1 (1 row) -SELECT pg_sleep(0.7); +SELECT pg_sleep(1.2); pg_sleep ---------- @@ -913,7 +913,7 @@ SELECT pg_stat_reset(); (1 row) ALTER TABLE s0.droptest RENAME id TO test; -SELECT pg_sleep(0.7); +SELECT pg_sleep(1.2); pg_sleep ---------- @@ -945,7 +945,7 @@ SELECT * FROM s0.droptest 1 (1 row) -SELECT pg_sleep(0.7); +SELECT pg_sleep(1.2); pg_sleep ---------- @@ -968,7 +968,7 @@ SELECT * FROM s0.droptest 1 (1 row) -SELECT pg_sleep(0.7); +SELECT pg_sleep(1.2); pg_sleep ---------- @@ -987,7 +987,7 @@ SELECT pg_stat_reset(); (1 row) ANALYZE; -SELECT pg_sleep(0.7); +SELECT pg_sleep(1.2); pg_sleep ---------- @@ -1042,7 +1042,7 @@ SELECT * FROM s0.droptest 4 (1 row) -SELECT pg_sleep(0.7); +SELECT pg_sleep(1.2); pg_sleep ---------- @@ -1061,7 +1061,7 @@ SELECT pg_stat_reset(); (1 row) VACUUM ANALYZE; -SELECT pg_sleep(0.7); +SELECT pg_sleep(1.2); pg_sleep ---------- @@ -1093,7 +1093,7 @@ SELECT * FROM s0.droptest 4 (1 row) -SELECT pg_sleep(0.7); +SELECT pg_sleep(1.2); pg_sleep ---------- diff --git a/sql/ut-common.sql b/sql/ut-common.sql index d0827b7..107a84e 100644 --- a/sql/ut-common.sql +++ b/sql/ut-common.sql @@ -321,19 +321,19 @@ SELECT dbms_stats.unlock_database_stats(); SELECT dbms_stats.lock_table_stats('st1'); SELECT relname, curpages FROM dbms_stats.relation_stats_locked WHERE relid = 'st1'::regclass; -SELECT pg_sleep(0.7); +SELECT pg_sleep(1.2); SELECT load_merged_stats(); SELECT pg_stat_reset(); VACUUM ANALYZE; UPDATE dbms_stats.relation_stats_locked SET curpages = 1000 WHERE relid = 'st1_exp'::regclass; -SELECT pg_sleep(0.7); +SELECT pg_sleep(1.2); SELECT * FROM lockd_io; SELECT load_merged_stats(); SELECT pg_stat_reset(); SELECT relname, curpages FROM dbms_stats.relation_stats_locked WHERE relid = 'st1'::regclass; -SELECT pg_sleep(0.7); +SELECT pg_sleep(1.2); SELECT * FROM lockd_io; /* @@ -375,17 +375,17 @@ INSERT INTO s0.droptest VALUES (1),(2),(3); VACUUM ANALYZE; SELECT * FROM s0.droptest WHERE id = 1; -SELECT pg_sleep(0.7); +SELECT pg_sleep(1.2); SELECT load_merged_stats(); SELECT pg_stat_reset(); ALTER TABLE s0.droptest RENAME TO test; -SELECT pg_sleep(0.7); +SELECT pg_sleep(1.2); SELECT * FROM lockd_io; SELECT load_merged_stats(); SELECT pg_stat_reset(); SELECT * FROM s0.test WHERE id = 1; -SELECT pg_sleep(0.7); +SELECT pg_sleep(1.2); SELECT * FROM lockd_io; ALTER TABLE s0.test RENAME TO droptest; @@ -393,17 +393,17 @@ ALTER TABLE s0.test RENAME TO droptest; VACUUM ANALYZE; SELECT * FROM s0.droptest WHERE id = 1; -SELECT pg_sleep(0.7); +SELECT pg_sleep(1.2); SELECT load_merged_stats(); SELECT pg_stat_reset(); ALTER TABLE s0.droptest RENAME id TO test; -SELECT pg_sleep(0.7); +SELECT pg_sleep(1.2); SELECT * FROM lockd_io; SELECT load_merged_stats(); SELECT pg_stat_reset(); SELECT * FROM s0.droptest WHERE test = 1; -SELECT pg_sleep(0.7); +SELECT pg_sleep(1.2); SELECT * FROM lockd_io; ALTER TABLE s0.droptest RENAME test TO id; @@ -411,11 +411,11 @@ ALTER TABLE s0.droptest RENAME test TO id; INSERT INTO s0.droptest VALUES (4); SELECT * FROM s0.droptest WHERE id = 1; -SELECT pg_sleep(0.7); +SELECT pg_sleep(1.2); SELECT load_merged_stats(); SELECT pg_stat_reset(); ANALYZE; -SELECT pg_sleep(0.7); +SELECT pg_sleep(1.2); SELECT * FROM lockd_io; SELECT load_merged_stats(); SELECT pg_stat_reset(); @@ -429,17 +429,17 @@ DELETE FROM s0.droptest; INSERT INTO s0.droptest VALUES (4),(5); SELECT * FROM s0.droptest WHERE id = 4; -SELECT pg_sleep(0.7); +SELECT pg_sleep(1.2); SELECT load_merged_stats(); SELECT pg_stat_reset(); VACUUM ANALYZE; -SELECT pg_sleep(0.7); +SELECT pg_sleep(1.2); SELECT * FROM lockd_io; SELECT load_merged_stats(); SELECT pg_stat_reset(); SELECT * FROM s0.droptest WHERE id = 4; -SELECT pg_sleep(0.7); +SELECT pg_sleep(1.2); SELECT * FROM lockd_io; -- clean up From 88efcbd03303be14697c4d22573900eb2cbc33a3 Mon Sep 17 00:00:00 2001 From: Alexey Makhmutov Date: Tue, 21 Feb 2023 17:53:09 +0300 Subject: [PATCH 5/6] Synchronize content of dbms_stats_estimate_rel_size with PG15 sources --- pg_dbms_stats.c | 207 ++++++++++++++++++++++-------------------------- 1 file changed, 96 insertions(+), 111 deletions(-) diff --git a/pg_dbms_stats.c b/pg_dbms_stats.c index 8d67efa..a94abe0 100644 --- a/pg_dbms_stats.c +++ b/pg_dbms_stats.c @@ -1653,7 +1653,7 @@ init_rel_stats_entry(StatsRelationEntry *entry, Oid relid) * the attribute widths for estimation purposes. * * Note: This function is copied from plancat.c in core source tree of version - * 14, and customized for pg_dbms_stats. Changes from original one are: + * 15, and customized for pg_dbms_stats. Changes from original one are: * - rename by prefixing dbms_stats_ * - add 1 parameters (curpage) to pass dummy curpage values. * - Get current # of pages only when supplied curpages is InvalidBlockNumber @@ -1669,125 +1669,110 @@ dbms_stats_estimate_rel_size(Relation rel, int32 *attr_widths, BlockNumber relallvisible; double density; - switch (rel->rd_rel->relkind) + if (RELKIND_HAS_TABLE_AM(rel->rd_rel->relkind)) { - case RELKIND_RELATION: - case RELKIND_MATVIEW: - case RELKIND_TOASTVALUE: - /* it has storage, ok to call the smgr */ - if (curpages == InvalidBlockNumber) - curpages = RelationGetNumberOfBlocks(rel); - - dbms_stats_table_relation_estimate_size(rel, attr_widths, pages, tuples, - allvisfrac, - HEAP_OVERHEAD_BYTES_PER_TUPLE, - HEAP_USABLE_BYTES_PER_PAGE, - curpages); - break; - - case RELKIND_INDEX: + if (curpages == InvalidBlockNumber) + curpages = RelationGetNumberOfBlocks(rel); + dbms_stats_table_relation_estimate_size(rel, attr_widths, pages, tuples, + allvisfrac, + HEAP_OVERHEAD_BYTES_PER_TUPLE, + HEAP_USABLE_BYTES_PER_PAGE, + curpages); + } + else if (rel->rd_rel->relkind == RELKIND_INDEX) + { + /* + * XXX: It'd probably be good to move this into a callback, individual + * index types e.g. know if they have a metapage. + */ - /* - * XXX: It'd probably be good to move this into a callback, - * individual index types e.g. know if they have a metapage. - */ + /* it has storage, ok to call the smgr */ + if (curpages == InvalidBlockNumber) + curpages = RelationGetNumberOfBlocks(rel); - /* it has storage, ok to call the smgr */ - if (curpages == InvalidBlockNumber) - curpages = RelationGetNumberOfBlocks(rel); + /* report estimated # pages */ + *pages = curpages; + /* quick exit if rel is clearly empty */ + if (curpages == 0) + { + *tuples = 0; + *allvisfrac = 0; + return; + } - /* report estimated # pages */ - *pages = curpages; - /* quick exit if rel is clearly empty */ - if (curpages == 0) - { - *tuples = 0; - *allvisfrac = 0; - break; - } + /* coerce values in pg_class to more desirable types */ + relpages = (BlockNumber) rel->rd_rel->relpages; + reltuples = (double) rel->rd_rel->reltuples; + relallvisible = (BlockNumber) rel->rd_rel->relallvisible; - /* coerce values in pg_class to more desirable types */ - relpages = (BlockNumber) rel->rd_rel->relpages; - reltuples = (double) rel->rd_rel->reltuples; - relallvisible = (BlockNumber) rel->rd_rel->relallvisible; + /* + * Discount the metapage while estimating the number of tuples. This + * is a kluge because it assumes more than it ought to about index + * structure. Currently it's OK for btree, hash, and GIN indexes but + * suspect for GiST indexes. + */ + if (relpages > 0) + { + curpages--; + relpages--; + } + /* estimate number of tuples from previous tuple density */ + if (reltuples >= 0 && relpages > 0) + density = reltuples / (double) relpages; + else + { /* - * Discount the metapage while estimating the number of tuples. - * This is a kluge because it assumes more than it ought to about - * index structure. Currently it's OK for btree, hash, and GIN - * indexes but suspect for GiST indexes. + * If we have no data because the relation was never vacuumed, + * estimate tuple width from attribute datatypes. We assume here + * that the pages are completely full, which is OK for tables + * (since they've presumably not been VACUUMed yet) but is + * probably an overestimate for indexes. Fortunately + * get_relation_info() can clamp the overestimate to the parent + * table's size. + * + * Note: this code intentionally disregards alignment + * considerations, because (a) that would be gilding the lily + * considering how crude the estimate is, and (b) it creates + * platform dependencies in the default plans which are kind of a + * headache for regression testing. + * + * XXX: Should this logic be more index specific? */ - if (relpages > 0) - { - curpages--; - relpages--; - } - + int32 tuple_width; - /* estimate number of tuples from previous tuple density */ - if (reltuples >= 0 && relpages > 0) - density = reltuples / (double) relpages; - else - { - /* - * If we have no data because the relation was never vacuumed, - * estimate tuple width from attribute datatypes. We assume - * here that the pages are completely full, which is OK for - * tables (since they've presumably not been VACUUMed yet) but - * is probably an overestimate for indexes. Fortunately - * get_relation_info() can clamp the overestimate to the - * parent table's size. - * - * Note: this code intentionally disregards alignment - * considerations, because (a) that would be gilding the lily - * considering how crude the estimate is, and (b) it creates - * platform dependencies in the default plans which are kind - * of a headache for regression testing. - * - * XXX: Should this logic be more index specific? - */ - int32 tuple_width; - - tuple_width = dbms_stats_get_rel_data_width(rel, attr_widths); - tuple_width += MAXALIGN(SizeofHeapTupleHeader); - tuple_width += sizeof(ItemIdData); - /* note: integer division is intentional here */ - density = (BLCKSZ - SizeOfPageHeaderData) / tuple_width; - } - *tuples = rint(density * (double) curpages); - - /* - * We use relallvisible as-is, rather than scaling it up like we - * do for the pages and tuples counts, on the theory that any - * pages added since the last VACUUM are most likely not marked - * all-visible. But costsize.c wants it converted to a fraction. - */ - if (relallvisible == 0 || curpages <= 0) - *allvisfrac = 0; - else if ((double) relallvisible >= curpages) - *allvisfrac = 1; - else - *allvisfrac = (double) relallvisible / curpages; - break; + tuple_width = dbms_stats_get_rel_data_width(rel, attr_widths); + tuple_width += MAXALIGN(SizeofHeapTupleHeader); + tuple_width += sizeof(ItemIdData); + /* note: integer division is intentional here */ + density = (BLCKSZ - SizeOfPageHeaderData) / tuple_width; + } + *tuples = rint(density * (double) curpages); - case RELKIND_SEQUENCE: - /* Sequences always have a known size */ - *pages = 1; - *tuples = 1; - *allvisfrac = 0; - break; - case RELKIND_FOREIGN_TABLE: - /* Just use whatever's in pg_class */ - *pages = rel->rd_rel->relpages; - *tuples = rel->rd_rel->reltuples; - *allvisfrac = 0; - break; - default: - /* else it has no disk storage; probably shouldn't get here? */ - *pages = 0; - *tuples = 0; + /* + * We use relallvisible as-is, rather than scaling it up like we do + * for the pages and tuples counts, on the theory that any pages added + * since the last VACUUM are most likely not marked all-visible. But + * costsize.c wants it converted to a fraction. + */ + if (relallvisible == 0 || curpages <= 0) *allvisfrac = 0; - break; + else if ((double) relallvisible >= curpages) + *allvisfrac = 1; + else + *allvisfrac = (double) relallvisible / curpages; + } + else + { + /* + * Just use whatever's in pg_class. This covers foreign tables, + * sequences, and also relkinds without storage (shouldn't get here?); + * see initializations in AddNewRelationTuple(). Note that FDW must + * cope if reltuples is -1! + */ + *pages = rel->rd_rel->relpages; + *tuples = rel->rd_rel->reltuples; + *allvisfrac = 0; } } @@ -1805,7 +1790,7 @@ dbms_stats_estimate_rel_size(Relation rel, int32 *attr_widths, * necessarily the wrong thing anyway. * * Note: This function is copied from plancat.c in core source tree of version - * 14, and just renamed. + * 15, and just renamed. */ static int32 dbms_stats_get_rel_data_width(Relation rel, int32 *attr_widths) @@ -1866,7 +1851,7 @@ dbms_stats_get_rel_data_width(Relation rel, int32 *attr_widths) * special space. * * Note: This function is copied from tableam.c in core source tree of version - * 14, and just renamed.Changes from original one are: + * 15, and just renamed.Changes from original one are: * - rename by prefixing dbms_stats_ * - add 1 parameters (curpage) to pass dummy curpage values. * From 684d47af81ea080d4b9a7f780dbc8f289eccf3d5 Mon Sep 17 00:00:00 2001 From: Alexey Makhmutov Date: Tue, 21 Feb 2023 17:54:44 +0300 Subject: [PATCH 6/6] Update version in spec comment --- SPECS/pg_dbms_stats.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SPECS/pg_dbms_stats.spec b/SPECS/pg_dbms_stats.spec index 5467704..7b77641 100644 --- a/SPECS/pg_dbms_stats.spec +++ b/SPECS/pg_dbms_stats.spec @@ -1,4 +1,4 @@ -# SPEC file for pg_dbms_stats14 +# SPEC file for pg_dbms_stats15 # Copyright(c) 2012-2022, NIPPON TELEGRAPH AND TELEPHONE CORPORATION %define _pgdir /usr/pgsql-15