Home Explore Blog CI



postgresql

8th chunk of `doc/src/sgml/ref/pg_basebackup.sgml`
24bd4ba25951f21e33c845f8e79d065c580f1f51b71b2ae30000000100000fa6
      all tar filenames. When the plain format is used, client-side
        compression may not be specified, but it is still possible to request
        server-side compression. If this is done, the server will compress the
        backup for transmission, and the client will decompress and extract it.
       </para>
       <para>
        When this option is used in combination with
        <literal>-Xstream</literal>, <literal>pg_wal.tar</literal> will
        be compressed using <literal>gzip</literal> if client-side gzip
        compression is selected, but will not be compressed if any other
        compression algorithm is selected, or if server-side compression
        is selected.
       </para>
      </listitem>
     </varlistentry>
    </variablelist>
   </para>
   <para>
    The following command-line options control the generation of the
    backup and the invocation of the program:

    <variablelist>
     <varlistentry>
      <term><option>-c {fast|spread}</option></term>
      <term><option>--checkpoint={fast|spread}</option></term>
      <listitem>
       <para>
        Sets checkpoint mode to fast (immediate) or spread (the default)
        (see <xref linkend="backup-lowlevel-base-backup"/>).
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-C</option></term>
      <term><option>--create-slot</option></term>
      <listitem>
       <para>
        Specifies that the replication slot named by the
        <literal>--slot</literal> option should be created before starting
        the backup.  An error is raised if the slot already exists.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-l <replaceable class="parameter">label</replaceable></option></term>
      <term><option>--label=<replaceable class="parameter">label</replaceable></option></term>
      <listitem>
       <para>
        Sets the label for the backup. If none is specified, a default value of
        <quote><literal>pg_basebackup base backup</literal></quote> will be used.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-n</option></term>
      <term><option>--no-clean</option></term>
      <listitem>
       <para>
        By default, when <command>pg_basebackup</command> aborts with an
        error, it removes any directories it might have created before
        discovering that it cannot finish the job (for example, the target
        directory and write-ahead log directory). This option inhibits
        tidying-up and is thus useful for debugging.
       </para>

       <para>
        Note that tablespace directories are not cleaned up either way.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-N</option></term>
      <term><option>--no-sync</option></term>
      <listitem>
       <para>
        By default, <command>pg_basebackup</command> will wait for all files
        to be written safely to disk.  This option causes
        <command>pg_basebackup</command> to return without waiting, which is
        faster, but means that a subsequent operating system crash can leave
        the base backup corrupt.  Generally, this option is useful for testing
        but should not be used when creating a production installation.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-P</option></term>
      <term><option>--progress</option></term>
      <listitem>
       <para>
        Enables progress reporting. Turning this on will deliver an approximate
        progress report during the backup. Since the database may change during
        the backup, this is only an approximation and may not end at exactly
        <literal>100%</literal>. In particular, when WAL log is included in the
        backup, the total amount of data cannot be estimated in advance, and
        in this case the estimated target size will increase once it passes

Title: pg_basebackup: Backup Generation and Invocation Options
Summary
This section details command-line options for `pg_basebackup` that control the generation and invocation of the backup process. It covers options like checkpoint mode (`-c`), replication slot creation (`-C`), setting a backup label (`-l`), preventing cleanup on errors (`-n`), skipping synchronization to disk (`-N`), and enabling progress reporting (`-P`). These options allow users to customize the backup behavior for different scenarios, balancing speed, safety, and information.