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

Change pg_dump default for statistics export.

Set the default behavior of pg_dump and pg_dumpall to be
--no-statistics.

Leave the default for pg_restore and pg_upgrade to be
--with-statistics.

Discussion: https://postgr.es/m/CA+TgmoZ9=RnWcCOZiKYYjZs_AW1P4QXCw--h4dOLLHuf1Omung@mail.gmail.com
Reviewed-by: Greg Sabino Mullane <htamfids@gmail.com>
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
This commit is contained in:
Jeff Davis
2025-05-27 12:53:10 -07:00
parent 4c08ecd161
commit 34eb2a80d5
5 changed files with 81 additions and 22 deletions

View File

@ -1134,7 +1134,7 @@ PostgreSQL documentation
<term><option>--no-statistics</option></term>
<listitem>
<para>
Do not dump statistics.
Do not dump statistics. This is the default.
</para>
</listitem>
</varlistentry>
@ -1461,7 +1461,7 @@ PostgreSQL documentation
<term><option>--with-statistics</option></term>
<listitem>
<para>
Dump statistics. This is the default.
Dump statistics.
</para>
</listitem>
</varlistentry>
@ -1681,14 +1681,14 @@ CREATE DATABASE foo WITH TEMPLATE template0;
</para>
<para>
By default, <command>pg_dump</command> will include most optimizer
statistics in the resulting dump file. However, some statistics may not be
included, such as those created explicitly with <xref
linkend="sql-createstatistics"/> or custom statistics added by an
extension. Therefore, it may be useful to run <command>ANALYZE</command>
after restoring from a dump file to ensure optimal performance; see <xref
linkend="vacuum-for-statistics"/> and <xref linkend="autovacuum"/> for more
information.
If <option>--with-statistics</option> is specified,
<command>pg_dump</command> will include most optimizer statistics in the
resulting dump file. However, some statistics may not be included, such as
those created explicitly with <xref linkend="sql-createstatistics"/> or
custom statistics added by an extension. Therefore, it may be useful to
run <command>ANALYZE</command> after restoring from a dump file to ensure
optimal performance; see <xref linkend="vacuum-for-statistics"/> and <xref
linkend="autovacuum"/> for more information.
</para>
<para>

View File

@ -567,7 +567,7 @@ exclude database <replaceable class="parameter">PATTERN</replaceable>
<term><option>--no-statistics</option></term>
<listitem>
<para>
Do not dump statistics.
Do not dump statistics. This is the default.
</para>
</listitem>
</varlistentry>
@ -741,7 +741,7 @@ exclude database <replaceable class="parameter">PATTERN</replaceable>
<term><option>--with-statistics</option></term>
<listitem>
<para>
Dump statistics. This is the default.
Dump statistics.
</para>
</listitem>
</varlistentry>
@ -957,14 +957,14 @@ exclude database <replaceable class="parameter">PATTERN</replaceable>
</para>
<para>
By default, <command>pg_dumpall</command> will include most optimizer
statistics in the resulting dump file. However, some statistics may not be
included, such as those created explicitly with <xref
linkend="sql-createstatistics"/> or custom statistics added by an
extension. Therefore, it may be useful to run <command>ANALYZE</command>
on each database after restoring from a dump file to ensure optimal
performance. You can also run <command>vacuumdb -a -z</command> to analyze
all databases.
If <option>--with-statistics</option> is specified,
<command>pg_dumpall</command> will include most optimizer statistics in the
resulting dump file. However, some statistics may not be included, such as
those created explicitly with <xref linkend="sql-createstatistics"/> or
custom statistics added by an extension. Therefore, it may be useful to
run <command>ANALYZE</command> on each database after restoring from a dump
file to ensure optimal performance. You can also run <command>vacuumdb -a
-z</command> to analyze all databases.
</para>
<para>