From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Michael Nolan <htfoot@gmail.com>
To: pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Subject: Re: Trigger functions and FDW tables
Date: Mon, 04 Apr 2022 16:23:40 +0200
Message-ID: <1b6e2aca7c1540db4e6437f643425da38ef93663.camel@cybertec.at> (raw)
In-Reply-To: <CAOzAquKaD+aXPUN0z88Yqi4CcnW62Y4Fq=iaoChBZniYzJb7FA@mail.gmail.com>
References: <CAOzAquKaD+aXPUN0z88Yqi4CcnW62Y4Fq=iaoChBZniYzJb7FA@mail.gmail.com>
On Mon, 2022-04-04 at 09:18 -0500, Michael Nolan wrote:
> Is it not recommended to use a FDW table in a trigger function?
Yes, I would say that is not recommended. While a lag of a few seconds,
like you describe, should not be the normal case (you should investigate that),
it is hard to exclude it in the face of network failures (you could end up
waiting for the keepalive timeout of 2 hours).
So the trigger can potentially run a long time, which makes your transaction
long. A long transaction can block other sessions or autovacuum progress.
The rule of thumb is that you should have nothing inside a database transaction
that *could* take a long time (even if it is normally fast).
Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com
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: laurenz.albe@cybertec.at, htfoot@gmail.com
Subject: Re: Trigger functions and FDW tables
In-Reply-To: <1b6e2aca7c1540db4e6437f643425da38ef93663.camel@cybertec.at>
References: <CAOzAquKaD+aXPUN0z88Yqi4CcnW62Y4Fq=iaoChBZniYzJb7FA@mail.gmail.com> <1b6e2aca7c1540db4e6437f643425da38ef93663.camel@cybertec.at>
* 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