pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Mats Julian Olsen <mats@duneanalytics.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: postgres_fdw insert extremely slow
Date: Wed, 25 Nov 2020 08:41:09 -0800
Message-ID: <3862aa4d-01c7-c76b-4497-ebce1af702cc@aklaver.com> (raw)
In-Reply-To: <CAARtqpE-7mZY8WKKMq2fWeHBcrAJu41_GnKgKqdvkidk7g+M3A@mail.gmail.com>
References: <CAARtqpE-7mZY8WKKMq2fWeHBcrAJu41_GnKgKqdvkidk7g+M3A@mail.gmail.com>

On 11/25/20 8:37 AM, Mats Julian Olsen wrote:
> Helle pgsql-general,
> 
> We have just set up postgres_fdw between two postgres databases, x and 
> y, with the plan to periodically insert data from x into y.
> 
> We've successfully set up the connection with a few options: 
> `use_remote_estimate 'true'` and `fetch_size '50000'` (the latter we've 
> played around with). We've run ANALYZE on the foreign server.
> 
> SELECTs against the foreign table returns in milliseconds, however an 
> INSERT of 100 rows takes 10 seconds. we have roughly 200 000 rows for 
> the initial sync, which translates into ~6 hours.

Postgres version(s)?

Without the actual query and EXPLAIN ANALYZE on it this will be 
difficult to answer with any detail.

Also would be nice to have the table schema.

> 
> Is this the expected performance of postgre_fdw? Is there anything we've 
> overlooked when setting this up? Very curious to hear experiences from 
> the community when doing read/write and not just read from foreign sources.
> 
> Best regards,
> 
> -- 
> Mats
> CTO @ Dune Analytics
> We're hiring: https://careers.duneanalytics.com 
> <https://careers.duneanalytics.com;


-- 
Adrian Klaver
adrian.klaver@aklaver.com





view thread (17+ messages)  latest in thread

Message-ID: <3862aa4d-01c7-c76b-4497-ebce1af702cc@aklaver.com>
Permalink:  ../3862aa4d-01c7-c76b-4497-ebce1af702cc@aklaver.com/
Also on:    postgresql.org/message-id/3862aa4d-01c7-c76b-4497-ebce1af702cc@aklaver.com

 · 

reply

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: adrian.klaver@aklaver.com, mats@duneanalytics.com
  Subject: Re: postgres_fdw insert extremely slow
  In-Reply-To: <3862aa4d-01c7-c76b-4497-ebce1af702cc@aklaver.com>
  References: <CAARtqpE-7mZY8WKKMq2fWeHBcrAJu41_GnKgKqdvkidk7g+M3A@mail.gmail.com> <3862aa4d-01c7-c76b-4497-ebce1af702cc@aklaver.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