Documentation fixups for dumping statistics.
authorJeff Davis
Sat, 22 Feb 2025 18:03:11 +0000 (10:03 -0800)
committerJeff Davis
Sat, 22 Feb 2025 18:03:11 +0000 (10:03 -0800)
Reported-by: Hayato Kuroda (Fujitsu)
Reported-by: Andrew Dunstan
Discussion: https://postgr.es/m/OSCPR01MB149665630030E7F54FDA8B27BF5C72@OSCPR01MB14966.jpnprd01.prod.outlook.com
Discussion: https://postgr.es/m/25d26774-25fa-46f2-9888-c6a707d1fef7@dunslane.net

doc/src/sgml/ref/pg_dump.sgml
doc/src/sgml/ref/pg_dumpall.sgml
doc/src/sgml/ref/pg_restore.sgml
doc/src/sgml/ref/pgupgrade.sgml
src/bin/pg_upgrade/check.c

index c7a22022fa697e53022f1d6bf4fad4057e36c72b..1975054d7bfbbd685a318d3ee19634bf5f667043 100644 (file)
@@ -521,8 +521,8 @@ PostgreSQL documentation
         Dump only the object definitions (schema), not data or statistics.
        
        
-        This option is mutually exclusive to 
-        and .
+        This option cannot be used with 
+        or .
         It is similar to, but for historical reasons not identical to,
         specifying
         .
@@ -1635,12 +1635,14 @@ CREATE DATABASE foo WITH TEMPLATE template0;
   
 
   
-   The dump file produced by pg_dump
-   does not contain the statistics used by the optimizer to make
-   query planning decisions.  Therefore, it is wise to run
-   ANALYZE after restoring from a dump file
-   to ensure optimal performance; see 
-   and  for more information.
+   By default, pg_dump will include most optimizer
+   statistics in the resulting dump file.  However, some statistics may not be
+   included, such as those created explicitly with 
+   linkend="sql-createstatistics"/> or custom statistics added by an
+   extension.  Therefore, it may be useful to run ANALYZE
+   after restoring from a dump file to ensure optimal performance; see 
+   linkend="vacuum-for-statistics"/> and  for more
+   information.
   
 
   
index f0823765c4e3fdf2aa850f2f67136c74b10fbbca..c2fa5be95193b79471a73004a53d195d1f5ac6e9 100644 (file)
@@ -830,10 +830,14 @@ exclude database PATTERN
   
 
   
-   Once restored, it is wise to run ANALYZE on each
-   database so the optimizer has useful statistics. You
-   can also run vacuumdb -a -z to analyze all
-   databases.
+   By default, pg_dumpall will include most optimizer
+   statistics in the resulting dump file.  However, some statistics may not be
+   included, such as those created explicitly with 
+   linkend="sql-createstatistics"/> or custom statistics added by an
+   extension.  Therefore, it may be useful to run ANALYZE
+   on each database after restoring from a dump file to ensure optimal
+   performance.  You can also run vacuumdb -a -z to analyze
+   all databases.
   
 
   
index b403170843072f7e448385a0f334449455e38306..199ea3345f30cc361175f504321fd212563e15f9 100644 (file)
@@ -483,8 +483,8 @@ PostgreSQL documentation
         to the extent that schema entries are present in the archive.
        
        
-        This option is mutually exclusive of 
-        and .
+        This option cannot be used with 
+        or .
         It is similar to, but for historical reasons not identical to,
         specifying
         .
@@ -1080,10 +1080,12 @@ CREATE DATABASE foo WITH TEMPLATE template0;
   
 
   
-   Once restored, it is wise to run ANALYZE on each
-   restored table so the optimizer has useful statistics; see
-    and
-    for more information.
+   By default, pg_restore will restore optimizer statistics
+   if included in the dump file.  If not all statistics were restored, it may
+   be useful to run ANALYZE on each restored table so the
+   optimizer has useful statistics; see 
+   linkend="vacuum-for-statistics"/> and  for more
+   information.
   
 
  
index 6f29ffad76baa3a274b37b2ff9948dfbe4e58aee..7bdd85c5cff40b468bcf7c044ee4e5f2c299e5ab 100644 (file)
@@ -792,10 +792,19 @@ psql --username=postgres --file=script.sql postgres
     Statistics
 
     
-     Because optimizer statistics are not transferred by pg_upgrade, you will
-     be instructed to run a command to regenerate that information at the end
-     of the upgrade.  You might need to set connection parameters to
-     match your new cluster.
+     Unless the  option is specified,
+     pg_upgrade will transfer most optimizer statistics
+     from the old cluster to the new cluster.  However, some statistics may
+     not be transferred, such as those created explicitly with 
+     linkend="sql-createstatistics"/> or custom statistics added by an
+     extension.
+    
+
+    
+     Because not all statistics are not transferred by
+     pg_upgrade, you will be instructed to run a command to
+     regenerate that information at the end of the upgrade.  You might need to
+     set connection parameters to match your new cluster.
     
 
     
index d6f629dd3a2bd411cad9e3477275006ba87c8dfb..88db8869b6e06e1c90f627bbfe40cdc73448e0ab 100644 (file)
@@ -779,7 +779,7 @@ output_completion_banner(char *deletion_script_file_name)
    }
 
    pg_log(PG_REPORT,
-          "Optimizer statistics are not transferred by pg_upgrade.\n"
+          "Some optimizer statistics may not have been transferred by pg_upgrade.\n"
           "Once you start the new server, consider running:\n"
           "    %s/vacuumdb %s--all --analyze-in-stages", new_cluster.bindir, user_specification.data);