1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

postgres_fdw: Add support for parallel abort.

postgres_fdw aborts remote (sub)transactions opened on remote server(s)
in a local (sub)transaction one by one when the local (sub)transaction
aborts.  This patch allows it to abort the remote (sub)transactions in
parallel to improve performance.  This is enabled by the server option
"parallel_abort".  The default is false.

Etsuro Fujita, reviewed by David Zhang.

Discussion: http://postgr.es/m/CAPmGK15FuPVGx3TGHKShsbPKKtF1y58-ZLcKoxfN-nqLj1dZ%3Dg%40mail.gmail.com
This commit is contained in:
Etsuro Fujita
2023-04-06 17:30:00 +09:00
parent b9b125b9c1
commit 983ec23007
5 changed files with 489 additions and 43 deletions

View File

@ -510,12 +510,13 @@ OPTIONS (ADD password_required 'false');
corresponding remote transactions, and subtransactions are managed by
creating corresponding remote subtransactions. When multiple remote
transactions are involved in the current local transaction, by default
<filename>postgres_fdw</filename> commits those remote transactions
serially when the local transaction is committed. When multiple remote
subtransactions are involved in the current local subtransaction, by
default <filename>postgres_fdw</filename> commits those remote
subtransactions serially when the local subtransaction is committed.
Performance can be improved with the following option:
<filename>postgres_fdw</filename> commits or aborts those remote
transactions serially when the local transaction is committed or aborted.
When multiple remote subtransactions are involved in the current local
subtransaction, by default <filename>postgres_fdw</filename> commits or
aborts those remote subtransactions serially when the local subtransaction
is committed or abortd.
Performance can be improved with the following options:
</para>
<variablelist>
@ -531,24 +532,38 @@ OPTIONS (ADD password_required 'false');
specified for foreign servers, not per-table. The default is
<literal>false</literal>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>parallel_abort</literal> (<type>boolean</type>)</term>
<listitem>
<para>
If multiple foreign servers with this option enabled are involved in a
local transaction, multiple remote transactions on those foreign
servers are committed in parallel across those foreign servers when
the local transaction is committed.
</para>
<para>
When this option is enabled, a foreign server with many remote
transactions may see a negative performance impact when the local
transaction is committed.
This option controls whether <filename>postgres_fdw</filename> aborts
in parallel remote transactions opened on a foreign server in a local
transaction when the local transaction is aborted. This setting also
applies to remote and local subtransactions. This option can only be
specified for foreign servers, not per-table. The default is
<literal>false</literal>.
</para>
</listitem>
</varlistentry>
</variablelist>
<para>
If multiple foreign servers with these options enabled are involved in a
local transaction, multiple remote transactions on those foreign servers
are committed or aborted in parallel across those foreign servers when
the local transaction is committed or aborted.
</para>
<para>
When these options are enabled, a foreign server with many remote
transactions may see a negative performance impact when the local
transaction is committed or aborted.
</para>
</sect3>
<sect3 id="postgres-fdw-options-updatability">