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

From: David Zhang <david(dot)zhang(at)highgo(dot)ca>
To: Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
Subject: Re: postgres_fdw: commit remote (sub)transactions in parallel during pre-commit
Date: 2021-11-01 22:46:39
Message-ID: 046f54b1-cdb7-88fb-5287-c48628092ca1@highgo.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> I evaluated the effectiveness of the patch using a simple
> multi-statement transaction:
>
> BEGIN;
> SAVEPOINT s;
> INSERT INTO ft1 VALUES (10, 10);
> INSERT INTO ft2 VALUES (20, 20);
> RELEASE SAVEPOINT s;
> COMMIT;
>
> where ft1 and ft2 are foreign tables created on different foreign
> servers hosted on different machines. I ran the transaction five
> times using the patch with the option enabled/disabled, and measured
> the latencies for the RELEASE and COMMIT commands in each run. The
> average latencies for these commands over the five runs are:
>
> * RELEASE
> parallel_commit=0: 0.385 ms
> parallel_commit=1: 0.221 ms
>
> * COMMIT
> parallel_commit=0: 1.660 ms
> parallel_commit=1: 0.861 ms
>
> With the option enabled, the average latencies for both commands are
> reduced significantly!
Followed your instructions, I performed some basic tests to compare the
performance between before and after. In my testing environment (two
foreign servers on the same local machine), the performance varies,
sometimes the time spent on RELEASE and COMMIT without patch are close
to after patched, but seems it always perform better after patched. Then
I ran a 1-millions tuples insert, 5 times average is something like below,

Before
    RELEASE 0.171 ms, COMMIT 1.861 ms

After
    RELEASE 0.147 ms, COMMIT 1.305 ms

Best regards,
--
David

Software Engineer
Highgo Software Inc. (Canada)
www.highgo.ca

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2021-11-01 23:49:08 Re: Partial aggregates pushdown
Previous Message Mark Dilger 2021-11-01 22:44:32 Re: Non-superuser subscription owners