Skip to content

Commit c9d502e

Browse files
Update guidance for running vacuumdb after pg_upgrade.
Now that pg_upgrade can carry over most optimizer statistics, we should recommend using vacuumdb's new --missing-stats-only option to only analyze relations that are missing statistics. Reviewed-by: John Naylor <johncnaylorls@gmail.com> Discussion: https://postgr.es/m/Z5O1bpcwDrMgyrYy%40nathan
1 parent edba754 commit c9d502e

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

doc/src/sgml/ref/pgupgrade.sgml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -807,10 +807,11 @@ psql --username=postgres --file=script.sql postgres
807807
</para>
808808

809809
<para>
810-
Using <command>vacuumdb --all --analyze-only</command> can efficiently
811-
generate such statistics, and the use of <option>--jobs</option>
812-
can speed it up. Option <option>--analyze-in-stages</option>
813-
can be used to generate minimal statistics quickly.
810+
Using <command>vacuumdb --all --analyze-only --missing-stats-only</command>
811+
can efficiently generate such statistics. Alternatively,
812+
<command>vacuumdb --all --analyze-in-stages --missing-stats-only</command>
813+
can be used to generate minimal statistics quickly. For either command,
814+
the use of <option>--jobs</option> can speed it up.
814815
If <varname>vacuum_cost_delay</varname> is set to a non-zero
815816
value, this can be overridden to speed up statistics generation
816817
using <envar>PGOPTIONS</envar>, e.g., <literal>PGOPTIONS='-c

src/bin/pg_upgrade/check.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ output_completion_banner(char *deletion_script_file_name)
781781
pg_log(PG_REPORT,
782782
"Some optimizer statistics may not have been transferred by pg_upgrade.\n"
783783
"Once you start the new server, consider running:\n"
784-
" %s/vacuumdb %s--all --analyze-in-stages", new_cluster.bindir, user_specification.data);
784+
" %s/vacuumdb %s--all --analyze-in-stages --missing-stats-only", new_cluster.bindir, user_specification.data);
785785

786786
if (deletion_script_file_name)
787787
pg_log(PG_REPORT,

0 commit comments

Comments
 (0)