From: pinker <pinker@onet.eu>
To: pgsql-general@postgresql.org
Subject: pg_sleep() inside plpgsql block - pro & cons
Date: Tue, 2 Oct 2018 03:10:03 -0700 (MST)
Message-ID: <1538475003972-0.post@n3.nabble.com> (raw)
Hi!
There is second time I see that somebody uses pg_sleep function inside
plpgsql block. This case is quite similar to the last one - it's some kind
of wait for data to be loaded. After pg_sleep there is a check if some
condition is true, if not procedure goes to sleep again. As a result an
average duration of this function is 1,5h...
I'm trying to gather pros and cons regarding using pg_sleep this way. What's
coming to my mind are only 2 cons:
* clog contention
* long running open transactions (which is quite good described in here:
https://www.simononsoftware.com/are-long-running-transactions-bad/)
So maybe you'll add some more to the list?
--
Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html
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: pinker@onet.eu
Subject: Re: pg_sleep() inside plpgsql block - pro & cons
In-Reply-To: <1538475003972-0.post@n3.nabble.com>
References: <1538475003972-0.post@n3.nabble.com>
* 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