Re: Inserting a timed delay in a pl/pgsql procedure - Mailing list pgsql-admin

From John DeSoi
Subject Re: Inserting a timed delay in a pl/pgsql procedure
Date
Msg-id C9CA00EE-2ACB-4A86-AD84-EEA4E3198322@pgedit.com
Whole thread Raw
In response to Inserting a timed delay in a pl/pgsql procedure  ("Benjamin Krajmalnik" <kraj@illumen.com>)
Responses Re: Inserting a timed delay in a pl/pgsql procedure  (Michael Fuhr <mike@fuhr.org>)
List pgsql-admin
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


pgsql-admin by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: Restoring database question..
Next
From: Michael Fuhr
Date:
Subject: Re: Inserting a timed delay in a pl/pgsql procedure