1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

vacuumdb: Add option for analyzing only relations missing stats.

This commit adds a new --missing-stats-only option that can be used
with --analyze-only or --analyze-in-stages.  When this option is
specified, vacuumdb will analyze a relation if it lacks any
statistics for a column, expression index, or extended statistics
object.  This new option is primarily intended for use after
pg_upgrade (since it can now retain most optimizer statistics), but
it might be useful in other situations, too.

Author: Corey Huinker <corey.huinker@gmail.com>
Co-authored-by: Nathan Bossart <nathandbossart@gmail.com>
Reviewed-by: John Naylor <johncnaylorls@gmail.com>
Discussion: https://postgr.es/m/Z5O1bpcwDrMgyrYy%40nathan
This commit is contained in:
Nathan Bossart
2025-03-18 16:32:56 -05:00
parent 9c03c8d187
commit edba754f05
4 changed files with 215 additions and 2 deletions

View File

@ -277,6 +277,22 @@ PostgreSQL documentation
</listitem>
</varlistentry>
<varlistentry>
<term><option>--missing-stats-only</option></term>
<listitem>
<para>
Only analyze relations that are missing statistics for a column, index
expression, or extended statistics object. This option prevents
<application>vacuumdb</application> from deleting existing statistics
so that the query optimizer's choices do not become transiently worse.
</para>
<para>
This option can only be used in conjunction with
<option>--analyze-only</option> or <option>--analyze-in-stages</option>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-n <replaceable class="parameter">schema</replaceable></option></term>
<term><option>--schema=<replaceable class="parameter">schema</replaceable></option></term>