Re: pg_sleep() inside plpgsql block - pro & cons - Mailing list pgsql-general

From Francisco Olarte
Subject Re: pg_sleep() inside plpgsql block - pro & cons
Date
Msg-id CA+bJJbwQ9mF2gZVXp0nAqLgCwoWii=BB-BfdwVdzo8fecse1eA@mail.gmail.com
Whole thread Raw
In response to Re: pg_sleep() inside plpgsql block - pro & cons  (pinker <pinker@onet.eu>)
List pgsql-general
On Tue, Oct 2, 2018 at 3:44 PM, pinker <pinker@onet.eu> wrote:
...
> Yes, I do try to convince them to do it outside the db, that's the reason
> I'm looking for some support here :) I'm not sure those 2 reasons are enough
> to convince them, wanted to be prepared...

Well, not knowing the logic I cannot be sure, but you can try the "it
depends on isolation level" I pointed to.

> You know it's always time to do refactoring and in this case it's a lot of
> time because of the amount and complexity of the logic in db.

Not having seen it, I trust your word. But I doubt the dessign can be
correct, it seems a case of "all I know is pl/xx, so I'll do
everything I can in it. I got one product with a similar problem in
Oracle.

But unless the logic is really perverse, it seems to me you could do
two procs, the normal one ( without the pg_sleep in a loop ), and a
wrapping one testing for the "data appears" condition and calling the
first, and call the second in a loop. But again, details will be
needed and trusting your words I do not want them on the list ;->  .

Francisco Olarte.


pgsql-general by date:

Previous
From: Malik Rumi
Date:
Subject: FTS trigger works 1 at a time, but fails with bulk insert script
Next
From: Carl Sverre
Date:
Subject: Re: Postgres trigger side-effect is occurring out of order withrow-level security select policy