From: Mats Julian Olsen <mats@duneanalytics.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Adrian Klaver <adrian.klaver@aklaver.com>
Cc: pgsql-general@lists.postgresql.org
Cc: wilhelm@duneanalytics.com
Subject: Re: postgres_fdw insert extremely slow
Date: Wed, 25 Nov 2020 20:01:17 +0100
Message-ID: <56a2c3cf-374d-893b-2feb-964805ff0884@duneanalytics.com> (raw)
In-Reply-To: <494596.1606324345@sss.pgh.pa.us>
References: <CAARtqpE-7mZY8WKKMq2fWeHBcrAJu41_GnKgKqdvkidk7g+M3A@mail.gmail.com>
<3862aa4d-01c7-c76b-4497-ebce1af702cc@aklaver.com>
<10df210c-a1bb-f909-9a48-61ac54880df0@duneanalytics.com>
<493978.1606323509@sss.pgh.pa.us>
<a5d9aeaa-83bf-457a-e04c-b6a66bee306f@duneanalytics.com>
<494596.1606324345@sss.pgh.pa.us>
On 25.11.2020 18:12, Tom Lane wrote:
> Mats Julian Olsen <mats@duneanalytics.com> writes:
>> On 25.11.2020 17:58, Tom Lane wrote:
>>> ... Have you tried looking into pg_locks on the
>>> remote server while this query is running?
>> Thanks Tom, I'll try to spin up a regular Postgres instance on both rds
>> and ec2 and see if that helps. As for the locks, I can not see any
>> blocked activity on the remote server while the query runs.
> Another place to check is pg_stat_activity, specifically wait_event_type
> and wait_event.
Thanks Tom, I've now setup the fdw from a local postgres instance and
seeing similar timings for the selects and inserts.
I've got some more numbers here:
x (aurora aws eu-west-1) => y (gcp gce us-central-1): ~15 s
local (eu) => y: ~15 s
local (eu) => test 1 (postgres aws rds eu-west-1): ~4 s
local (eu) => test 2 (postgres google cloud sql, us-central-1): ~15s
local (eu) => local (eu): < 1s
SELECTs in all instances are sub-second.
To me this does indicate some sort of networking issue, but I'm
wondering if INSERTs are treated differently than SELECTs in
postgres_fdw? The only feasibly explanation I have is that postgres_fdw
does many more network calls for INSERT than for SELECT, e.g. something
like 1 for SELECT and `n` for INSERT?
Best,
Mats
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: mats@duneanalytics.com, tgl@sss.pgh.pa.us, adrian.klaver@aklaver.com, wilhelm@duneanalytics.com
Subject: Re: postgres_fdw insert extremely slow
In-Reply-To: <56a2c3cf-374d-893b-2feb-964805ff0884@duneanalytics.com>
References: <CAARtqpE-7mZY8WKKMq2fWeHBcrAJu41_GnKgKqdvkidk7g+M3A@mail.gmail.com> <3862aa4d-01c7-c76b-4497-ebce1af702cc@aklaver.com> <10df210c-a1bb-f909-9a48-61ac54880df0@duneanalytics.com> <493978.1606323509@sss.pgh.pa.us> <a5d9aeaa-83bf-457a-e04c-b6a66bee306f@duneanalytics.com> <494596.1606324345@sss.pgh.pa.us> <56a2c3cf-374d-893b-2feb-964805ff0884@duneanalytics.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox