Re: postgres_fdw insert extremely slow

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: pabloa98 <pabloa98(at)gmail(dot)com>
Cc: Mats Julian Olsen <mats(at)duneanalytics(dot)com>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>, wilhelm(at)duneanalytics(dot)com
Subject: Re: postgres_fdw insert extremely slow
Date: 2020-11-27 21:25:25
Message-ID: CAKFQuwbZHpiAx6L-55DUcJ1Kj=yzUvxCiW6zC06t+BQ1Y_nLyA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Nov 27, 2020 at 2:00 PM pabloa98 <pabloa98(at)gmail(dot)com> wrote:

> I would like to suggest for postgres_fdw: If the foreign database is
> PostgreSQL,
>

Just to be clear, the "postgres" part of the name means the remote database
must be a PostgreSQL database, there is no "if". Likewise, for the
extension mysql_fdw the remote database is "MySQL".

> the link should just pass through all the CRUD SQL commands to the other
> database.
>
> If the other database is of a version so different that cannot make sense
> of the CRUD SQL command, it will generate an error and that's it.
>
> This would be very useful to keep datasets synchronized.
>
>
We already offer a tool for that, dblink.

https://www.postgresql.org/docs/current/dblink.html

But the generalized behavior of FDW doesn't work to just send a raw SQL
command across, even for CRUD.
e.g.,
UPDATE remote_tbl
SET ...
FROM local_tbl
WHERE remote_tbl.col_id=local_tbl.col_id;
or
INSERT INTO remote_tbl SELECT * FROM local_tbl;

Not saying that there isn't room for improvement here but I'm doubting it's
simple.

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2020-11-27 22:13:28 Re: SV: Problem with pg_notify / listen
Previous Message pabloa98 2020-11-27 21:00:20 Re: postgres_fdw insert extremely slow