From: John DeSoi <desoi@pgedit.com>
To: Benjamin Krajmalnik <kraj@illumen.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Inserting a timed delay in a pl/pgsql procedure
Date: Fri, 18 Aug 2006 15:50:02 -0400
Message-ID: <C9CA00EE-2ACB-4A86-AD84-EEA4E3198322@pgedit.com> (raw)
In-Reply-To: <BF337097BDD9D849A2F4B818DDB27987252603@stash.stackdump.local>
References: <BF337097BDD9D849A2F4B818DDB27987252603@stash.stackdump.local>
On Aug 18, 2006, at 3:26 PM, Benjamin Krajmalnik wrote:
> However, it appears that current_timestamp is not being recalculated.
> Any ideas? While normally we want the stored procedures to run as
> quickly as possible, this is a case where I need to insert a delay.
> I guess an option would be to place a counter and loop through it, but
> it does not allow me the control I relly need.
current_timestamp returns the same value for the scope of the
transaction (or function call). Search the archives for "sleep" for
previous discussions of this issue. You can use timeofday to get a
changing time value, but any looping you do in plpgsql will eat a lot
of CPU cycles. The only other solution I recall was to use a
different pl language like perl which has a proper sleep function.
John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL
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-admin@postgresql.org
Cc: desoi@pgedit.com, kraj@illumen.com
Subject: Re: Inserting a timed delay in a pl/pgsql procedure
In-Reply-To: <C9CA00EE-2ACB-4A86-AD84-EEA4E3198322@pgedit.com>
References: <BF337097BDD9D849A2F4B818DDB27987252603@stash.stackdump.local> <C9CA00EE-2ACB-4A86-AD84-EEA4E3198322@pgedit.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