Re: Trigger functions and FDW tables - Mailing list pgsql-general

From Laurenz Albe
Subject Re: Trigger functions and FDW tables
Date
Msg-id 1b6e2aca7c1540db4e6437f643425da38ef93663.camel@cybertec.at
Whole thread Raw
In response to Trigger functions and FDW tables  (Michael Nolan <htfoot@gmail.com>)
Responses Re: Trigger functions and FDW tables  (Michael Nolan <htfoot@gmail.com>)
List pgsql-general
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




pgsql-general by date:

Previous
From: Michael Nolan
Date:
Subject: Trigger functions and FDW tables
Next
From: Arup Nanda
Date:
Subject: Re: gist segmentation fault