Home Explore Blog CI



postgresql

9th chunk of `doc/src/sgml/ref/pg_basebackup.sgml`
a4ea9c3bf1570b3e8bc11db51e6eda5de063be6f521059610000000100000fa6
 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 the
        total estimate without WAL.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-r <replaceable class="parameter">rate</replaceable></option></term>
      <term><option>--max-rate=<replaceable class="parameter">rate</replaceable></option></term>
      <listitem>
       <para>
        Sets the maximum transfer rate at which data is collected from the
        source server.  This can be useful to limit the impact
        of <application>pg_basebackup</application> on the server.  Values
        are in kilobytes per second.  Use a suffix of <literal>M</literal>
        to indicate megabytes per second.  A suffix of <literal>k</literal>
        is also accepted, and has no effect.  Valid values are between 32
        kilobytes per second and 1024 megabytes per second.
       </para>
       <para>
        This option always affects transfer of the data directory. Transfer of
        WAL files is only affected if the collection method
        is <literal>fetch</literal>.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-S <replaceable>slotname</replaceable></option></term>
      <term><option>--slot=<replaceable class="parameter">slotname</replaceable></option></term>
      <listitem>
       <para>
        This option can only be used together with <literal>-X
        stream</literal>.  It causes WAL streaming to use the specified
        replication slot.  If the base backup is intended to be used as a
        streaming-replication standby using a replication slot, the standby
        should then use the same replication slot name as
        <xref linkend="guc-primary-slot-name"/>.  This ensures that the
        primary server does not remove any necessary WAL data in the time
        between the end of the base backup and the start of streaming
        replication on the new standby.
       </para>
       <para>
        The specified replication slot has to exist unless the
        option <option>-C</option> is also used.
       </para>
       <para>
        If this option is not specified and the server supports temporary
        replication slots (version 10 and later), then a temporary replication
        slot is automatically used for WAL streaming.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>--sync-method=<replaceable class="parameter">method</replaceable></option></term>
      <listitem>
       <para>
        When set to <literal>fsync</literal>, which is the default,
        <command>pg_basebackup</command> will recursively open and synchronize
        all files in the backup directory.  When the plain format is used, the
        search for files will follow symbolic links for the WAL directory and
        each configured tablespace.
       </para>
       <para>
        On Linux, <literal>syncfs</literal> may be used instead to ask the
        operating system to synchronize the whole file system

Title: pg_basebackup: Additional Backup Options - Progress, Rate Limiting, Replication Slots, and Synchronization
Summary
This section describes additional options for `pg_basebackup`. It covers enabling progress reporting (`-P`), limiting the transfer rate (`-r`), using a replication slot for WAL streaming (`-S`), and specifying the synchronization method (`--sync-method`). These options provide more granular control over the backup process, allowing users to manage performance, data consistency, and integration with replication setups.