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

View File

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

View File

@ -152,7 +152,7 @@ InitDumpOptions(DumpOptions *opts)
opts->dumpSections = DUMP_UNSECTIONED; opts->dumpSections = DUMP_UNSECTIONED;
opts->dumpSchema = true; opts->dumpSchema = true;
opts->dumpData = true; opts->dumpData = true;
opts->dumpStatistics = true; opts->dumpStatistics = false;
} }
/* /*

View File

@ -68,6 +68,7 @@ my %pgdump_runs = (
'--no-data', '--no-data',
'--sequence-data', '--sequence-data',
'--binary-upgrade', '--binary-upgrade',
'--with-statistics',
'--dbname' => 'postgres', # alternative way to specify database '--dbname' => 'postgres', # alternative way to specify database
], ],
restore_cmd => [ restore_cmd => [
@ -75,6 +76,7 @@ my %pgdump_runs = (
'--format' => 'custom', '--format' => 'custom',
'--verbose', '--verbose',
'--file' => "$tempdir/binary_upgrade.sql", '--file' => "$tempdir/binary_upgrade.sql",
'--with-statistics',
"$tempdir/binary_upgrade.dump", "$tempdir/binary_upgrade.dump",
], ],
}, },
@ -88,11 +90,13 @@ my %pgdump_runs = (
'--format' => 'custom', '--format' => 'custom',
'--compress' => '1', '--compress' => '1',
'--file' => "$tempdir/compression_gzip_custom.dump", '--file' => "$tempdir/compression_gzip_custom.dump",
'--with-statistics',
'postgres', 'postgres',
], ],
restore_cmd => [ restore_cmd => [
'pg_restore', 'pg_restore',
'--file' => "$tempdir/compression_gzip_custom.sql", '--file' => "$tempdir/compression_gzip_custom.sql",
'--with-statistics',
"$tempdir/compression_gzip_custom.dump", "$tempdir/compression_gzip_custom.dump",
], ],
command_like => { command_like => {
@ -115,6 +119,7 @@ my %pgdump_runs = (
'--format' => 'directory', '--format' => 'directory',
'--compress' => 'gzip:1', '--compress' => 'gzip:1',
'--file' => "$tempdir/compression_gzip_dir", '--file' => "$tempdir/compression_gzip_dir",
'--with-statistics',
'postgres', 'postgres',
], ],
# Give coverage for manually compressed blobs.toc files during # Give coverage for manually compressed blobs.toc files during
@ -132,6 +137,7 @@ my %pgdump_runs = (
'pg_restore', 'pg_restore',
'--jobs' => '2', '--jobs' => '2',
'--file' => "$tempdir/compression_gzip_dir.sql", '--file' => "$tempdir/compression_gzip_dir.sql",
'--with-statistics',
"$tempdir/compression_gzip_dir", "$tempdir/compression_gzip_dir",
], ],
}, },
@ -144,6 +150,7 @@ my %pgdump_runs = (
'--format' => 'plain', '--format' => 'plain',
'--compress' => '1', '--compress' => '1',
'--file' => "$tempdir/compression_gzip_plain.sql.gz", '--file' => "$tempdir/compression_gzip_plain.sql.gz",
'--with-statistics',
'postgres', 'postgres',
], ],
# Decompress the generated file to run through the tests. # Decompress the generated file to run through the tests.
@ -162,11 +169,13 @@ my %pgdump_runs = (
'--format' => 'custom', '--format' => 'custom',
'--compress' => 'lz4', '--compress' => 'lz4',
'--file' => "$tempdir/compression_lz4_custom.dump", '--file' => "$tempdir/compression_lz4_custom.dump",
'--with-statistics',
'postgres', 'postgres',
], ],
restore_cmd => [ restore_cmd => [
'pg_restore', 'pg_restore',
'--file' => "$tempdir/compression_lz4_custom.sql", '--file' => "$tempdir/compression_lz4_custom.sql",
'--with-statistics',
"$tempdir/compression_lz4_custom.dump", "$tempdir/compression_lz4_custom.dump",
], ],
command_like => { command_like => {
@ -189,6 +198,7 @@ my %pgdump_runs = (
'--format' => 'directory', '--format' => 'directory',
'--compress' => 'lz4:1', '--compress' => 'lz4:1',
'--file' => "$tempdir/compression_lz4_dir", '--file' => "$tempdir/compression_lz4_dir",
'--with-statistics',
'postgres', 'postgres',
], ],
# Verify that data files were compressed # Verify that data files were compressed
@ -200,6 +210,7 @@ my %pgdump_runs = (
'pg_restore', 'pg_restore',
'--jobs' => '2', '--jobs' => '2',
'--file' => "$tempdir/compression_lz4_dir.sql", '--file' => "$tempdir/compression_lz4_dir.sql",
'--with-statistics',
"$tempdir/compression_lz4_dir", "$tempdir/compression_lz4_dir",
], ],
}, },
@ -212,6 +223,7 @@ my %pgdump_runs = (
'--format' => 'plain', '--format' => 'plain',
'--compress' => 'lz4', '--compress' => 'lz4',
'--file' => "$tempdir/compression_lz4_plain.sql.lz4", '--file' => "$tempdir/compression_lz4_plain.sql.lz4",
'--with-statistics',
'postgres', 'postgres',
], ],
# Decompress the generated file to run through the tests. # Decompress the generated file to run through the tests.
@ -233,11 +245,13 @@ my %pgdump_runs = (
'--format' => 'custom', '--format' => 'custom',
'--compress' => 'zstd', '--compress' => 'zstd',
'--file' => "$tempdir/compression_zstd_custom.dump", '--file' => "$tempdir/compression_zstd_custom.dump",
'--with-statistics',
'postgres', 'postgres',
], ],
restore_cmd => [ restore_cmd => [
'pg_restore', 'pg_restore',
'--file' => "$tempdir/compression_zstd_custom.sql", '--file' => "$tempdir/compression_zstd_custom.sql",
'--with-statistics',
"$tempdir/compression_zstd_custom.dump", "$tempdir/compression_zstd_custom.dump",
], ],
command_like => { command_like => {
@ -259,6 +273,7 @@ my %pgdump_runs = (
'--format' => 'directory', '--format' => 'directory',
'--compress' => 'zstd:1', '--compress' => 'zstd:1',
'--file' => "$tempdir/compression_zstd_dir", '--file' => "$tempdir/compression_zstd_dir",
'--with-statistics',
'postgres', 'postgres',
], ],
# Give coverage for manually compressed blobs.toc files during # Give coverage for manually compressed blobs.toc files during
@ -279,6 +294,7 @@ my %pgdump_runs = (
'pg_restore', 'pg_restore',
'--jobs' => '2', '--jobs' => '2',
'--file' => "$tempdir/compression_zstd_dir.sql", '--file' => "$tempdir/compression_zstd_dir.sql",
'--with-statistics',
"$tempdir/compression_zstd_dir", "$tempdir/compression_zstd_dir",
], ],
}, },
@ -292,6 +308,7 @@ my %pgdump_runs = (
'--format' => 'plain', '--format' => 'plain',
'--compress' => 'zstd:long', '--compress' => 'zstd:long',
'--file' => "$tempdir/compression_zstd_plain.sql.zst", '--file' => "$tempdir/compression_zstd_plain.sql.zst",
'--with-statistics',
'postgres', 'postgres',
], ],
# Decompress the generated file to run through the tests. # Decompress the generated file to run through the tests.
@ -310,6 +327,7 @@ my %pgdump_runs = (
'pg_dump', '--no-sync', 'pg_dump', '--no-sync',
'--file' => "$tempdir/clean.sql", '--file' => "$tempdir/clean.sql",
'--clean', '--clean',
'--with-statistics',
'--dbname' => 'postgres', # alternative way to specify database '--dbname' => 'postgres', # alternative way to specify database
], ],
}, },
@ -320,6 +338,7 @@ my %pgdump_runs = (
'--clean', '--clean',
'--if-exists', '--if-exists',
'--encoding' => 'UTF8', # no-op, just for testing '--encoding' => 'UTF8', # no-op, just for testing
'--with-statistics',
'postgres', 'postgres',
], ],
}, },
@ -338,6 +357,7 @@ my %pgdump_runs = (
'--create', '--create',
'--no-reconnect', # no-op, just for testing '--no-reconnect', # no-op, just for testing
'--verbose', '--verbose',
'--with-statistics',
'postgres', 'postgres',
], ],
}, },
@ -356,6 +376,7 @@ my %pgdump_runs = (
dump_cmd => [ dump_cmd => [
'pg_dump', '--no-sync', 'pg_dump', '--no-sync',
'--file' => "$tempdir/defaults.sql", '--file' => "$tempdir/defaults.sql",
'--with-statistics',
'postgres', 'postgres',
], ],
}, },
@ -364,6 +385,7 @@ my %pgdump_runs = (
dump_cmd => [ dump_cmd => [
'pg_dump', '--no-sync', 'pg_dump', '--no-sync',
'--file' => "$tempdir/defaults_no_public.sql", '--file' => "$tempdir/defaults_no_public.sql",
'--with-statistics',
'regress_pg_dump_test', 'regress_pg_dump_test',
], ],
}, },
@ -373,6 +395,7 @@ my %pgdump_runs = (
'pg_dump', '--no-sync', 'pg_dump', '--no-sync',
'--clean', '--clean',
'--file' => "$tempdir/defaults_no_public_clean.sql", '--file' => "$tempdir/defaults_no_public_clean.sql",
'--with-statistics',
'regress_pg_dump_test', 'regress_pg_dump_test',
], ],
}, },
@ -381,6 +404,7 @@ my %pgdump_runs = (
dump_cmd => [ dump_cmd => [
'pg_dump', '--no-sync', 'pg_dump', '--no-sync',
'--file' => "$tempdir/defaults_public_owner.sql", '--file' => "$tempdir/defaults_public_owner.sql",
'--with-statistics',
'regress_public_owner', 'regress_public_owner',
], ],
}, },
@ -395,12 +419,14 @@ my %pgdump_runs = (
'pg_dump', 'pg_dump',
'--format' => 'custom', '--format' => 'custom',
'--file' => "$tempdir/defaults_custom_format.dump", '--file' => "$tempdir/defaults_custom_format.dump",
'--with-statistics',
'postgres', 'postgres',
], ],
restore_cmd => [ restore_cmd => [
'pg_restore', 'pg_restore',
'--format' => 'custom', '--format' => 'custom',
'--file' => "$tempdir/defaults_custom_format.sql", '--file' => "$tempdir/defaults_custom_format.sql",
'--with-statistics',
"$tempdir/defaults_custom_format.dump", "$tempdir/defaults_custom_format.dump",
], ],
command_like => { command_like => {
@ -425,12 +451,14 @@ my %pgdump_runs = (
'pg_dump', 'pg_dump',
'--format' => 'directory', '--format' => 'directory',
'--file' => "$tempdir/defaults_dir_format", '--file' => "$tempdir/defaults_dir_format",
'--with-statistics',
'postgres', 'postgres',
], ],
restore_cmd => [ restore_cmd => [
'pg_restore', 'pg_restore',
'--format' => 'directory', '--format' => 'directory',
'--file' => "$tempdir/defaults_dir_format.sql", '--file' => "$tempdir/defaults_dir_format.sql",
'--with-statistics',
"$tempdir/defaults_dir_format", "$tempdir/defaults_dir_format",
], ],
command_like => { command_like => {
@ -456,11 +484,13 @@ my %pgdump_runs = (
'--format' => 'directory', '--format' => 'directory',
'--jobs' => 2, '--jobs' => 2,
'--file' => "$tempdir/defaults_parallel", '--file' => "$tempdir/defaults_parallel",
'--with-statistics',
'postgres', 'postgres',
], ],
restore_cmd => [ restore_cmd => [
'pg_restore', 'pg_restore',
'--file' => "$tempdir/defaults_parallel.sql", '--file' => "$tempdir/defaults_parallel.sql",
'--with-statistics',
"$tempdir/defaults_parallel", "$tempdir/defaults_parallel",
], ],
}, },
@ -472,12 +502,14 @@ my %pgdump_runs = (
'pg_dump', 'pg_dump',
'--format' => 'tar', '--format' => 'tar',
'--file' => "$tempdir/defaults_tar_format.tar", '--file' => "$tempdir/defaults_tar_format.tar",
'--with-statistics',
'postgres', 'postgres',
], ],
restore_cmd => [ restore_cmd => [
'pg_restore', 'pg_restore',
'--format' => 'tar', '--format' => 'tar',
'--file' => "$tempdir/defaults_tar_format.sql", '--file' => "$tempdir/defaults_tar_format.sql",
'--with-statistics',
"$tempdir/defaults_tar_format.tar", "$tempdir/defaults_tar_format.tar",
], ],
}, },
@ -486,6 +518,7 @@ my %pgdump_runs = (
'pg_dump', '--no-sync', 'pg_dump', '--no-sync',
'--file' => "$tempdir/exclude_dump_test_schema.sql", '--file' => "$tempdir/exclude_dump_test_schema.sql",
'--exclude-schema' => 'dump_test', '--exclude-schema' => 'dump_test',
'--with-statistics',
'postgres', 'postgres',
], ],
}, },
@ -494,6 +527,7 @@ my %pgdump_runs = (
'pg_dump', '--no-sync', 'pg_dump', '--no-sync',
'--file' => "$tempdir/exclude_test_table.sql", '--file' => "$tempdir/exclude_test_table.sql",
'--exclude-table' => 'dump_test.test_table', '--exclude-table' => 'dump_test.test_table',
'--with-statistics',
'postgres', 'postgres',
], ],
}, },
@ -502,6 +536,7 @@ my %pgdump_runs = (
'pg_dump', '--no-sync', 'pg_dump', '--no-sync',
'--file' => "$tempdir/exclude_measurement.sql", '--file' => "$tempdir/exclude_measurement.sql",
'--exclude-table-and-children' => 'dump_test.measurement', '--exclude-table-and-children' => 'dump_test.measurement',
'--with-statistics',
'postgres', 'postgres',
], ],
}, },
@ -511,6 +546,7 @@ my %pgdump_runs = (
'--file' => "$tempdir/exclude_measurement_data.sql", '--file' => "$tempdir/exclude_measurement_data.sql",
'--exclude-table-data-and-children' => 'dump_test.measurement', '--exclude-table-data-and-children' => 'dump_test.measurement',
'--no-unlogged-table-data', '--no-unlogged-table-data',
'--with-statistics',
'postgres', 'postgres',
], ],
}, },
@ -520,6 +556,7 @@ my %pgdump_runs = (
'--file' => "$tempdir/exclude_test_table_data.sql", '--file' => "$tempdir/exclude_test_table_data.sql",
'--exclude-table-data' => 'dump_test.test_table', '--exclude-table-data' => 'dump_test.test_table',
'--no-unlogged-table-data', '--no-unlogged-table-data',
'--with-statistics',
'postgres', 'postgres',
], ],
}, },
@ -538,6 +575,7 @@ my %pgdump_runs = (
'--file' => "$tempdir/pg_dumpall_globals.sql", '--file' => "$tempdir/pg_dumpall_globals.sql",
'--globals-only', '--globals-only',
'--no-sync', '--no-sync',
'--with-statistics',
], ],
}, },
pg_dumpall_globals_clean => { pg_dumpall_globals_clean => {
@ -547,12 +585,14 @@ my %pgdump_runs = (
'--globals-only', '--globals-only',
'--clean', '--clean',
'--no-sync', '--no-sync',
'--with-statistics',
], ],
}, },
pg_dumpall_dbprivs => { pg_dumpall_dbprivs => {
dump_cmd => [ dump_cmd => [
'pg_dumpall', '--no-sync', 'pg_dumpall', '--no-sync',
'--file' => "$tempdir/pg_dumpall_dbprivs.sql", '--file' => "$tempdir/pg_dumpall_dbprivs.sql",
'--with-statistics',
], ],
}, },
pg_dumpall_exclude => { pg_dumpall_exclude => {
@ -562,6 +602,7 @@ my %pgdump_runs = (
'--file' => "$tempdir/pg_dumpall_exclude.sql", '--file' => "$tempdir/pg_dumpall_exclude.sql",
'--exclude-database' => '*dump_test*', '--exclude-database' => '*dump_test*',
'--no-sync', '--no-sync',
'--with-statistics',
], ],
}, },
no_toast_compression => { no_toast_compression => {
@ -569,6 +610,7 @@ my %pgdump_runs = (
'pg_dump', '--no-sync', 'pg_dump', '--no-sync',
'--file' => "$tempdir/no_toast_compression.sql", '--file' => "$tempdir/no_toast_compression.sql",
'--no-toast-compression', '--no-toast-compression',
'--with-statistics',
'postgres', 'postgres',
], ],
}, },
@ -577,6 +619,7 @@ my %pgdump_runs = (
'pg_dump', '--no-sync', 'pg_dump', '--no-sync',
'--file' => "$tempdir/no_large_objects.sql", '--file' => "$tempdir/no_large_objects.sql",
'--no-large-objects', '--no-large-objects',
'--with-statistics',
'postgres', 'postgres',
], ],
}, },
@ -585,6 +628,7 @@ my %pgdump_runs = (
'pg_dump', '--no-sync', 'pg_dump', '--no-sync',
'--file' => "$tempdir/no_policies.sql", '--file' => "$tempdir/no_policies.sql",
'--no-policies', '--no-policies',
'--with-statistics',
'postgres', 'postgres',
], ],
}, },
@ -593,6 +637,7 @@ my %pgdump_runs = (
'pg_dump', '--no-sync', 'pg_dump', '--no-sync',
'--file' => "$tempdir/no_privs.sql", '--file' => "$tempdir/no_privs.sql",
'--no-privileges', '--no-privileges',
'--with-statistics',
'postgres', 'postgres',
], ],
}, },
@ -601,6 +646,7 @@ my %pgdump_runs = (
'pg_dump', '--no-sync', 'pg_dump', '--no-sync',
'--file' => "$tempdir/no_owner.sql", '--file' => "$tempdir/no_owner.sql",
'--no-owner', '--no-owner',
'--with-statistics',
'postgres', 'postgres',
], ],
}, },
@ -609,6 +655,7 @@ my %pgdump_runs = (
'pg_dump', '--no-sync', 'pg_dump', '--no-sync',
'--file' => "$tempdir/no_table_access_method.sql", '--file' => "$tempdir/no_table_access_method.sql",
'--no-table-access-method', '--no-table-access-method',
'--with-statistics',
'postgres', 'postgres',
], ],
}, },
@ -617,6 +664,7 @@ my %pgdump_runs = (
'pg_dump', '--no-sync', 'pg_dump', '--no-sync',
'--file' => "$tempdir/only_dump_test_schema.sql", '--file' => "$tempdir/only_dump_test_schema.sql",
'--schema' => 'dump_test', '--schema' => 'dump_test',
'--with-statistics',
'postgres', 'postgres',
], ],
}, },
@ -627,6 +675,7 @@ my %pgdump_runs = (
'--table' => 'dump_test.test_table', '--table' => 'dump_test.test_table',
'--lock-wait-timeout' => '--lock-wait-timeout' =>
(1000 * $PostgreSQL::Test::Utils::timeout_default), (1000 * $PostgreSQL::Test::Utils::timeout_default),
'--with-statistics',
'postgres', 'postgres',
], ],
}, },
@ -637,6 +686,7 @@ my %pgdump_runs = (
'--table-and-children' => 'dump_test.measurement', '--table-and-children' => 'dump_test.measurement',
'--lock-wait-timeout' => '--lock-wait-timeout' =>
(1000 * $PostgreSQL::Test::Utils::timeout_default), (1000 * $PostgreSQL::Test::Utils::timeout_default),
'--with-statistics',
'postgres', 'postgres',
], ],
}, },
@ -646,6 +696,7 @@ my %pgdump_runs = (
'--file' => "$tempdir/role.sql", '--file' => "$tempdir/role.sql",
'--role' => 'regress_dump_test_role', '--role' => 'regress_dump_test_role',
'--schema' => 'dump_test_second_schema', '--schema' => 'dump_test_second_schema',
'--with-statistics',
'postgres', 'postgres',
], ],
}, },
@ -658,11 +709,13 @@ my %pgdump_runs = (
'--file' => "$tempdir/role_parallel", '--file' => "$tempdir/role_parallel",
'--role' => 'regress_dump_test_role', '--role' => 'regress_dump_test_role',
'--schema' => 'dump_test_second_schema', '--schema' => 'dump_test_second_schema',
'--with-statistics',
'postgres', 'postgres',
], ],
restore_cmd => [ restore_cmd => [
'pg_restore', 'pg_restore',
'--file' => "$tempdir/role_parallel.sql", '--file' => "$tempdir/role_parallel.sql",
'--with-statistics',
"$tempdir/role_parallel", "$tempdir/role_parallel",
], ],
}, },
@ -691,6 +744,7 @@ my %pgdump_runs = (
'pg_dump', '--no-sync', 'pg_dump', '--no-sync',
'--file' => "$tempdir/section_pre_data.sql", '--file' => "$tempdir/section_pre_data.sql",
'--section' => 'pre-data', '--section' => 'pre-data',
'--with-statistics',
'postgres', 'postgres',
], ],
}, },
@ -699,6 +753,7 @@ my %pgdump_runs = (
'pg_dump', '--no-sync', 'pg_dump', '--no-sync',
'--file' => "$tempdir/section_data.sql", '--file' => "$tempdir/section_data.sql",
'--section' => 'data', '--section' => 'data',
'--with-statistics',
'postgres', 'postgres',
], ],
}, },
@ -707,6 +762,7 @@ my %pgdump_runs = (
'pg_dump', '--no-sync', 'pg_dump', '--no-sync',
'--file' => "$tempdir/section_post_data.sql", '--file' => "$tempdir/section_post_data.sql",
'--section' => 'post-data', '--section' => 'post-data',
'--with-statistics',
'postgres', 'postgres',
], ],
}, },
@ -717,6 +773,7 @@ my %pgdump_runs = (
'--schema' => 'dump_test', '--schema' => 'dump_test',
'--large-objects', '--large-objects',
'--no-large-objects', '--no-large-objects',
'--with-statistics',
'postgres', 'postgres',
], ],
}, },
@ -732,6 +789,7 @@ my %pgdump_runs = (
'pg_dump', '--no-sync', 'pg_dump', '--no-sync',
"--file=$tempdir/no_data_no_schema.sql", '--no-data', "--file=$tempdir/no_data_no_schema.sql", '--no-data',
'--no-schema', 'postgres', '--no-schema', 'postgres',
'--with-statistics',
], ],
}, },
statistics_only => { statistics_only => {
@ -752,6 +810,7 @@ my %pgdump_runs = (
dump_cmd => [ dump_cmd => [
'pg_dump', '--no-sync', 'pg_dump', '--no-sync',
"--file=$tempdir/no_schema.sql", '--no-schema', "--file=$tempdir/no_schema.sql", '--no-schema',
'--with-statistics',
'postgres', 'postgres',
], ],
},); },);

View File

@ -58,7 +58,7 @@ generate_old_dump(void)
(user_opts.transfer_mode == TRANSFER_MODE_SWAP) ? (user_opts.transfer_mode == TRANSFER_MODE_SWAP) ?
"" : "--sequence-data", "" : "--sequence-data",
log_opts.verbose ? "--verbose" : "", log_opts.verbose ? "--verbose" : "",
user_opts.do_statistics ? "" : "--no-statistics", user_opts.do_statistics ? "--with-statistics" : "--no-statistics",
log_opts.dumpdir, log_opts.dumpdir,
sql_file_name, escaped_connstr.data); sql_file_name, escaped_connstr.data);