Re: postgres_fdw: commit remote (sub)transactions in parallel during pre-commit

From: Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com>
To: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: postgres_fdw: commit remote (sub)transactions in parallel during pre-commit
Date: 2022-03-05 10:32:56
Message-ID: CAPmGK15SkX=1NrY+GVyZan4Za+f17FFnM9qtQvjCEMaE3ftPcg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Feb 28, 2022 at 6:53 PM Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com> wrote:
> Here is an updated version. I added to the 0003 patch a macro for
> defining the milliseconds to wait, as proposed by David upthread.

I modified the 0003 patch further: 1) I added to
pgfdw_cancel_query_end/pgfdw_exec_cleanup_query_end the PQconsumeInput
optimization that we have in do_sql_command_end, and 2) I
added/tweaked comments a bit further. Attached is an updated version.

Like [1], I ran a simple performance test using the following transaction:

BEGIN;
SAVEPOINT s;
INSERT INTO ft1 VALUES (10, 10);
INSERT INTO ft2 VALUES (20, 20);
ROLLBACK TO SAVEPOINT s;
RELEASE SAVEPOINT s;
INSERT INTO ft1 VALUES (10, 10);
INSERT INTO ft2 VALUES (20, 20);
ABORT;

where ft1 is a foreign table created on a foreign server hosted on the
same machine as the local server, and ft2 is a foreign table created
on a foreign server hosted on a different machine. (In this test I
used two machines, while in [1] I used three machines: one for the
local server and the others for ft1 and ft2.) The average latencies
for the ROLLBACK TO SAVEPOINT and ABORT commands over ten runs of the
above transaction with the parallel_abort option disabled/enabled are:

* ROLLBACK TO SAVEPOINT
parallel_abort=0: 0.3217 ms
parallel_abort=1: 0.2396 ms

* ABORT
parallel_abort=0: 0.4749 ms
parallel_abort=1: 0.3733 ms

This option reduces the latency for ROLLBACK TO SAVEPOINT by 25.5
percent, and the latency for ABORT by 21.4 percent. From the results,
I think the patch is useful.

Best regards,
Etsuro Fujita

[1] https://www.postgresql.org/message-id/CAPmGK17dAZCXvwnfpr1eTfknTGdt%3DhYTV9405Gt5SqPOX8K84w%40mail.gmail.com

Attachment Content-Type Size
v6-0002-postgres_fdw-Minor-cleanup-for-pgfdw_abort_cleanup.patch application/octet-stream 3.2 KB
v6-0003-postgres-fdw-Add-support-for-parallel-abort.patch application/octet-stream 26.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2022-03-05 10:33:34 Re: Make unlogged table resets detectable
Previous Message Michael Paquier 2022-03-05 10:31:53 Re: pl/pgsql feature request: shorthand for argument and local variable references