Re: Trigger functions and FDW tables

From: Michael Nolan <htfoot(at)gmail(dot)com>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Trigger functions and FDW tables
Date: 2022-04-04 16:15:26
Message-ID: CAOzAqu+cZJusr99Vt-Yoodzc7uEUJwJc4f4rAEUzy7B3JFQAkA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks for confirming my suspicions, I'm working on a plan B to deal with
this as best I can.
--
Mike Nolan

On Mon, Apr 4, 2022 at 9:23 AM Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
wrote:

> 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
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sebastien Flaesch 2022-04-04 16:20:26 Re: Transaction and SQL errors
Previous Message Adrian Klaver 2022-04-04 15:37:19 Re: how to find out field size?