1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-27 07:42:10 +03:00

vacuumdb: Add option for analyzing only relations missing stats.

This commit adds a new --missing-only option that can be used in
conjunction with --analyze-only and --analyze-in-stages.  When this
option is specified, vacuumdb will generate ANALYZE commands for a
relation if it is missing any statistics it should ordinarily have.
For example, if a table has statistics for one column but not
another, we will analyze the whole table.  A similar principle
applies to extended statistics, expression indexes, and table
inheritance.

Co-authored-by: Corey Huinker <corey.huinker@gmail.com>
Reviewed-by: TODO
Discussion: https://postgr.es/m/Z5O1bpcwDrMgyrYy%40nathan
This commit is contained in:
Nathan Bossart
2025-02-04 15:07:54 -06:00
committed by John Naylor
parent e2080261cc
commit 5f8eb25706
4 changed files with 195 additions and 0 deletions

View File

@@ -277,6 +277,22 @@ PostgreSQL documentation
</listitem>
</varlistentry>
<varlistentry>
<term><option>--missing-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> and <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>