Home Explore Blog CI



postgresql

4th chunk of `doc/src/sgml/ref/pg_restore.sgml`
2bd4dfc349dc4c5718c475f9045e4e154c06d84a185d2bab0000000100000fab
  <para>
        Restore only global objects (roles and tablespaces), no databases.
       </para>
       <para>
        This option is only relevant when restoring from an archive made using <application>pg_dumpall</application>.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-I <replaceable class="parameter">index</replaceable></option></term>
      <term><option>--index=<replaceable class="parameter">index</replaceable></option></term>
      <listitem>
       <para>
        Restore definition of named index only.  Multiple indexes
        may be specified with multiple <option>-I</option> switches.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-j <replaceable class="parameter">number-of-jobs</replaceable></option></term>
      <term><option>--jobs=<replaceable class="parameter">number-of-jobs</replaceable></option></term>
      <listitem>
       <para>
        Run the most time-consuming steps
        of <application>pg_restore</application> &mdash; those that load data,
        create indexes, or create constraints &mdash; concurrently, using up
        to <replaceable class="parameter">number-of-jobs</replaceable>
        concurrent sessions.  This option can dramatically reduce the time
        to restore a large database to a server running on a
        multiprocessor machine.  This option is ignored when emitting a script
        rather than connecting directly to a database server.
       </para>

       <para>
        Each job is one process or one thread, depending on the
        operating system, and uses a separate connection to the
        server.
       </para>

       <para>
        The optimal value for this option depends on the hardware
        setup of the server, of the client, and of the network.
        Factors include the number of CPU cores and the disk setup.  A
        good place to start is the number of CPU cores on the server,
        but values larger than that can also lead to faster restore
        times in many cases.  Of course, values that are too high will
        lead to decreased performance because of thrashing.
       </para>

       <para>
        Only the custom and directory archive formats are supported
        with this option.
        The input must be a regular file or directory (not, for example, a
        pipe or standard input).  Also, multiple
        jobs cannot be used together with the
        option <option>--single-transaction</option>.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-l</option></term>
      <term><option>--list</option></term>
      <listitem>
       <para>
        List the table of contents of the archive. The output of this operation
        can be used as input to the <option>-L</option> option.  Note that
        if filtering switches such as <option>-n</option> or <option>-t</option> are
        used with <option>-l</option>, they will restrict the items listed.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-L <replaceable class="parameter">list-file</replaceable></option></term>
      <term><option>--use-list=<replaceable class="parameter">list-file</replaceable></option></term>
      <listitem>
       <para>
        Restore only those archive elements that are listed in <replaceable
        class="parameter">list-file</replaceable>, and restore them in the
        order they appear in the file.  Note that
        if filtering switches such as <option>-n</option> or <option>-t</option> are
        used with <option>-L</option>, they will further restrict the items restored.
       </para>
       <para><replaceable class="parameter">list-file</replaceable> is normally created by
        editing the output of a previous <option>-l</option> operation.
        Lines can be moved or removed, and can also
        be commented out by placing a semicolon (<literal>;</literal>)

Title: pg_restore Options: Index Restoration, Concurrent Jobs, Listing Contents, and Using a List File
Summary
This section details more command-line options for pg_restore. It covers restoring specific indexes, running time-consuming steps concurrently using multiple jobs for faster restoration (only supported with custom and directory formats), listing the archive's table of contents, and restoring only elements listed in a specified file, which is typically created by editing the output of a previous list operation.