Re: pg_sleep() inside plpgsql block - pro & cons

From: Francisco Olarte <folarte(at)peoplecall(dot)com>
To: pinker <pinker(at)onet(dot)eu>
Cc: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: pg_sleep() inside plpgsql block - pro & cons
Date: 2018-10-02 17:47:52
Message-ID: CA+bJJbwQ9mF2gZVXp0nAqLgCwoWii=BB-BfdwVdzo8fecse1eA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Oct 2, 2018 at 3:44 PM, pinker <pinker(at)onet(dot)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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Carl Sverre 2018-10-02 19:12:32 Re: Postgres trigger side-effect is occurring out of order with row-level security select policy
Previous Message Malik Rumi 2018-10-02 17:34:48 FTS trigger works 1 at a time, but fails with bulk insert script