Home Explore Blog CI



postgresql

6th chunk of `doc/src/sgml/postgres-fdw.sgml`
6a17caf8d3a5d78b222b6050f8c508dc3e5a784331090f440000000100000fa2
 <literal>random</literal>
       depending on the remote server version.
      </para>
     </listitem>
    </varlistentry>

   </variablelist>

  </sect3>

  <sect3 id="postgres-fdw-options-remote-execution">
   <title>Remote Execution Options</title>

   <para>
    By default, only <literal>WHERE</literal> clauses using built-in operators and
    functions will be considered for execution on the remote server.  Clauses
    involving non-built-in functions are checked locally after rows are
    fetched.  If such functions are available on the remote server and can be
    relied on to produce the same results as they do locally, performance can
    be improved by sending such <literal>WHERE</literal> clauses for remote
    execution.  This behavior can be controlled using the following option:
   </para>

   <variablelist>

    <varlistentry>
     <term><literal>extensions</literal> (<type>string</type>)</term>
     <listitem>
      <para>
       This option is a comma-separated list of names
       of <productname>PostgreSQL</productname> extensions that are installed, in
       compatible versions, on both the local and remote servers.  Functions
       and operators that are immutable and belong to a listed extension will
       be considered shippable to the remote server.
       This option can only be specified for foreign servers, not per-table.
      </para>

      <para>
       When using the <literal>extensions</literal> option, <emphasis>it is the
       user's responsibility</emphasis> that the listed extensions exist and behave
       identically on both the local and remote servers.  Otherwise, remote
       queries may fail or behave unexpectedly.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><literal>fetch_size</literal> (<type>integer</type>)</term>
     <listitem>
      <para>
       This option specifies the number of rows <filename>postgres_fdw</filename>
       should get in each fetch operation. It can be specified for a foreign
       table or a foreign server. The option specified on a table overrides
       an option specified for the server.
       The default is <literal>100</literal>.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><literal>batch_size</literal> (<type>integer</type>)</term>
     <listitem>
      <para>
       This option specifies the number of rows <filename>postgres_fdw</filename>
       should insert in each insert operation. It can be specified for a
       foreign table or a foreign server. The option specified on a table
       overrides an option specified for the server.
       The default is <literal>1</literal>.
      </para>

      <para>
       Note the actual number of rows <filename>postgres_fdw</filename> inserts at
       once depends on the number of columns and the provided
       <literal>batch_size</literal> value. The batch is executed as a single
       query, and the libpq protocol (which <filename>postgres_fdw</filename>
       uses to connect to a remote server) limits the number of parameters in a
       single query to 65535. When the number of columns * <literal>batch_size</literal>
       exceeds the limit, the <literal>batch_size</literal> will be adjusted to
       avoid an error.
      </para>

      <para>
       This option also applies when copying into foreign tables.  In that case
       the actual number of rows <filename>postgres_fdw</filename> copies at
       once is determined in a similar way to the insert case, but it is
       limited to at most 1000 due to implementation restrictions of the
       <command>COPY</command> command.
      </para>
     </listitem>
    </varlistentry>

   </variablelist>

  </sect3>

  <sect3 id="postgres-fdw-options-asynchronous-execution">
   <title>Asynchronous Execution Options</title>

   <para>
    <filename>postgres_fdw</filename> supports asynchronous execution, which
    runs multiple parts of an <structname>Append</structname> node

Title: Postgres FDW Remote Execution and Asynchronous Execution Options
Summary
The postgres_fdw foreign data wrapper provides options to control remote execution, including the extensions option to specify PostgreSQL extensions that can be used for remote execution, and the fetch_size and batch_size options to control the number of rows fetched or inserted in each operation, as well as asynchronous execution options for running multiple parts of a query concurrently.