Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit fc4fa03

Browse files
author
Commitfest Bot
committed
[CF 5717] v2 - vacuumdb fixes for v18
This branch was automatically generated by a robot using patches from an email thread registered at: https://commitfest.postgresql.org/patch/5717 The branch will be overwritten each time a new patch version is posted to the thread, and also periodically to check for bitrot caused by changes on the master branch. Patch(es): https://www.postgresql.org/message-id/aAkKprD55h7_1F5v@nathan Author(s): Nathan Bossart
2 parents f8c115a + 193c31e commit fc4fa03

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

doc/src/sgml/ref/pgupgrade.sgml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -833,17 +833,19 @@ psql --username=postgres --file=script.sql postgres
833833

834834
<para>
835835
Because not all statistics are not transferred by
836-
<command>pg_upgrade</command>, you will be instructed to run a command to
836+
<command>pg_upgrade</command>, you will be instructed to run commands to
837837
regenerate that information at the end of the upgrade. You might need to
838838
set connection parameters to match your new cluster.
839839
</para>
840840

841841
<para>
842-
Using <command>vacuumdb --all --analyze-only --missing-stats-only</command>
843-
can efficiently generate such statistics. Alternatively,
842+
First, use
844843
<command>vacuumdb --all --analyze-in-stages --missing-stats-only</command>
845-
can be used to generate minimal statistics quickly. For either command,
846-
the use of <option>--jobs</option> can speed it up.
844+
to quickly generate minimal optimizer statistics for relations without
845+
any. Then, use <command>vacuumdb --all --analyze-only</command> to ensure
846+
all relations have updated cumulative statistics for triggering vacuum and
847+
analyze. For both commands, the use of <option>--jobs</option> can speed
848+
it up.
847849
If <varname>vacuum_cost_delay</varname> is set to a non-zero
848850
value, this can be overridden to speed up statistics generation
849851
using <envar>PGOPTIONS</envar>, e.g., <literal>PGOPTIONS='-c

src/bin/pg_upgrade/check.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -814,9 +814,12 @@ output_completion_banner(char *deletion_script_file_name)
814814
}
815815

816816
pg_log(PG_REPORT,
817-
"Some optimizer statistics may not have been transferred by pg_upgrade.\n"
818-
"Once you start the new server, consider running:\n"
819-
" %s/vacuumdb %s--all --analyze-in-stages --missing-stats-only", new_cluster.bindir, user_specification.data);
817+
"Some statistics are not transferred by pg_upgrade.\n"
818+
"Once you start the new server, consider running these two commands:\n"
819+
" %s/vacuumdb %s--all --analyze-in-stages --missing-stats-only\n"
820+
" %s/vacuumdb %s--all --analyze-only",
821+
new_cluster.bindir, user_specification.data,
822+
new_cluster.bindir, user_specification.data);
820823

821824
if (deletion_script_file_name)
822825
pg_log(PG_REPORT,

src/bin/scripts/vacuumdb.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -954,7 +954,6 @@ retrieve_objects(PGconn *conn, vacuumingOptions *vacopts,
954954
appendPQExpBufferStr(&catalog_query,
955955
" EXISTS (SELECT NULL FROM pg_catalog.pg_attribute a\n"
956956
" WHERE a.attrelid OPERATOR(pg_catalog.=) c.oid\n"
957-
" AND c.reltuples OPERATOR(pg_catalog.!=) 0::pg_catalog.float4\n"
958957
" AND a.attnum OPERATOR(pg_catalog.>) 0::pg_catalog.int2\n"
959958
" AND NOT a.attisdropped\n"
960959
" AND a.attstattarget IS DISTINCT FROM 0::pg_catalog.int2\n"
@@ -967,7 +966,6 @@ retrieve_objects(PGconn *conn, vacuumingOptions *vacopts,
967966
appendPQExpBufferStr(&catalog_query,
968967
" OR EXISTS (SELECT NULL FROM pg_catalog.pg_statistic_ext e\n"
969968
" WHERE e.stxrelid OPERATOR(pg_catalog.=) c.oid\n"
970-
" AND c.reltuples OPERATOR(pg_catalog.!=) 0::pg_catalog.float4\n"
971969
" AND e.stxstattarget IS DISTINCT FROM 0::pg_catalog.int2\n"
972970
" AND NOT EXISTS (SELECT NULL FROM pg_catalog.pg_statistic_ext_data d\n"
973971
" WHERE d.stxoid OPERATOR(pg_catalog.=) e.oid\n"
@@ -979,7 +977,6 @@ retrieve_objects(PGconn *conn, vacuumingOptions *vacopts,
979977
" JOIN pg_catalog.pg_index i"
980978
" ON i.indexrelid OPERATOR(pg_catalog.=) a.attrelid\n"
981979
" WHERE i.indrelid OPERATOR(pg_catalog.=) c.oid\n"
982-
" AND c.reltuples OPERATOR(pg_catalog.!=) 0::pg_catalog.float4\n"
983980
" AND i.indkey[a.attnum OPERATOR(pg_catalog.-) 1::pg_catalog.int2]"
984981
" OPERATOR(pg_catalog.=) 0::pg_catalog.int2\n"
985982
" AND a.attnum OPERATOR(pg_catalog.>) 0::pg_catalog.int2\n"
@@ -994,7 +991,6 @@ retrieve_objects(PGconn *conn, vacuumingOptions *vacopts,
994991
appendPQExpBufferStr(&catalog_query,
995992
" OR EXISTS (SELECT NULL FROM pg_catalog.pg_attribute a\n"
996993
" WHERE a.attrelid OPERATOR(pg_catalog.=) c.oid\n"
997-
" AND c.reltuples OPERATOR(pg_catalog.!=) 0::pg_catalog.float4\n"
998994
" AND a.attnum OPERATOR(pg_catalog.>) 0::pg_catalog.int2\n"
999995
" AND NOT a.attisdropped\n"
1000996
" AND a.attstattarget IS DISTINCT FROM 0::pg_catalog.int2\n"
@@ -1011,7 +1007,6 @@ retrieve_objects(PGconn *conn, vacuumingOptions *vacopts,
10111007
appendPQExpBufferStr(&catalog_query,
10121008
" OR EXISTS (SELECT NULL FROM pg_catalog.pg_statistic_ext e\n"
10131009
" WHERE e.stxrelid OPERATOR(pg_catalog.=) c.oid\n"
1014-
" AND c.reltuples OPERATOR(pg_catalog.!=) 0::pg_catalog.float4\n"
10151010
" AND e.stxstattarget IS DISTINCT FROM 0::pg_catalog.int2\n"
10161011
" AND c.relhassubclass\n"
10171012
" AND NOT p.inherited\n"

0 commit comments

Comments
 (0)