doc: add example of using pg_dump with GNU split and gzip
authorBruce Momjian <[email protected]>
Tue, 3 Aug 2021 14:57:32 +0000 (10:57 -0400)
committerBruce Momjian <[email protected]>
Tue, 3 Aug 2021 14:57:32 +0000 (10:57 -0400)
This is only possible with GNU split, not other versions like BSD split.

Reported-by: [email protected]
Discussion: https://postgr.es/m/162653459215.701.6323855956817776386@wrigleys.postgresql.org

Backpatch-through: 9.6

doc/src/sgml/backup.sgml

index b7ec53a5986fb41b70f760b615f53bf4ad47ec62..7c49b30e865dae14b6da09a69267e5c52c39b4f6 100644 (file)
@@ -273,10 +273,10 @@ cat <replaceable class="parameter">filename</replaceable>.gz | gunzip | psql <re
      The <command>split</command> command
      allows you to split the output into smaller files that are
      acceptable in size to the underlying file system. For example, to
-     make chunks of 1 megabyte:
+     make 2 gigabyte chunks:
 
 <programlisting>
-pg_dump <replaceable class="parameter">dbname</replaceable> | split -b 1m - <replaceable class="parameter">filename</replaceable>
+pg_dump <replaceable class="parameter">dbname</replaceable> | split -b 2G - <replaceable class="parameter">filename</replaceable>
 </programlisting>
 
      Reload with:
@@ -284,6 +284,15 @@ pg_dump <replaceable class="parameter">dbname</replaceable> | split -b 1m - <rep
 <programlisting>
 cat <replaceable class="parameter">filename</replaceable>* | psql <replaceable class="parameter">dbname</replaceable>
 </programlisting>
+
+     If using GNU <application>split</application>, it is possible to
+     use it and <application>gzip</application> together:
+
+<programlisting>
+pg_dump <replaceable class="parameter">dbname</replaceable> | split -b 2G --filter='gzip > $FILE.gz'
+</programlisting>
+
+     It can be restored using <command>zcat</command>.
     </para>
    </formalpara>