From dondrake@gmail.com Sun Aug 21 19:22:30 2005 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2808B1FEED6C for ; Sun, 21 Aug 2005 16:22:30 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 07597-09 for ; Sun, 21 Aug 2005 19:22:25 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.198]) by svr1.postgresql.org (Postfix) with ESMTP id 059A11FEED69 for ; Sun, 21 Aug 2005 16:22:25 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id i4so872722wra for ; Sun, 21 Aug 2005 12:22:25 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=Tmic1Y0PIVwEOnZ+vHsPShmD4D1tkbI5ATIzv/pcnxM9u+10L7/UC9P6m2SQ+bycmssRoPA5dq4I3xoFGiiZiPNly8MDzAZ8FoE60D0/7ajqIBFT5vtw1zdnLj2yvUFkyGhNq5YAWd2DCVCVfNlSEbAPDYvc5mEwLBmMhR5XIco= Received: by 10.54.83.5 with SMTP id g5mr1120069wrb; Sun, 21 Aug 2005 12:22:25 -0700 (PDT) Received: by 10.54.94.11 with HTTP; Sun, 21 Aug 2005 12:22:25 -0700 (PDT) Message-ID: <6c21003b050821122278e3d7d5@mail.gmail.com> Date: Sun, 21 Aug 2005 14:22:25 -0500 From: Don Drake To: pgsql-admin@postgresql.org Subject: sleep? Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_19091_18270318.1124652145130" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.081 required=5 tests=[AWL=-0.030, HTML_40_50=0.086, HTML_MESSAGE=0.001, RCVD_BY_IP=0.024] X-Spam-Level: X-Archive-Number: 200508/252 X-Sequence-Number: 18571 ------=_Part_19091_18270318.1124652145130 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Is there a sleep function in plpgsql? I need to wait a period time (60=20 seconds) in a while loop. I didn't see anything in the docs. Thanks. -Don --=20 Donald Drake President Drake Consulting http://www.drakeconsult.com/ http://www.MailLaunder.com/ http://www.mobilemeridian.com/ 312-560-1574 ------=_Part_19091_18270318.1124652145130 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Is there a sleep function in plpgsql?  I need to wait a period time (6= 0 seconds) in a while loop.

I didn't see anything in the docs.

Thanks.

-Don

--
Donald Drake
President
Drake Consulting
http://www.drakeconsult.com/
http://www.MailLaunder.com/
http://www.mobilemeridian.com/
312-560-1574

------=_Part_19091_18270318.1124652145130-- From greg@turnstep.com Sun Aug 21 23:17:06 2005 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 66C07D77C8 for ; Sun, 21 Aug 2005 20:17:06 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 84567-04 for ; Sun, 21 Aug 2005 23:16:57 +0000 (GMT) Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 8224DD76BC for ; Sun, 21 Aug 2005 20:16:33 -0300 (ADT) Received: from biglumber.com (biglumber.com [207.228.252.42]) by svr2.postgresql.org (Postfix) with SMTP id 3F675F0D92 for ; Sun, 21 Aug 2005 20:58:42 +0100 (BST) Received: (qmail 10460 invoked from network); 21 Aug 2005 20:03:03 -0000 Received: from unknown (HELO localhost) (207.228.252.42) by 0 with SMTP; 21 Aug 2005 20:03:03 -0000 From: "Greg Sabino Mullane" To: pgsql-admin@postgresql.org Subject: Re: sleep? X-PGP-Key: 2529 DF6A B8F7 9407 E944 45B4 BC9B 9067 1496 4AC8 X-Request-PGP: http://www.biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8 In-Reply-To: <6c21003b050821122278e3d7d5@mail.gmail.com> Date: Sun, 21 Aug 2005 20:03:03 -0000 X-Mailer: JoyMail 1.48 Message-ID: <0817d53432c7b8dc53a6cc9c014261e9@biglumber.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.208 required=5 tests=[AWL=0.001, UPPERCASE_25_50=0.207] X-Spam-Level: X-Archive-Number: 200508/255 X-Sequence-Number: 18574 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 > Is there a sleep function in plpgsql? I need to wait a period time > 60 seconds) in a while loop. You will need to us another language, such as plperl. You could certainly create a sleep function and have your plpgsql call that: CREATE FUNCTION sleep(INT) RETURNS TEXT LANGUAGE plperl AS $$ select(undef,undef,undef,shift); return "Time to wake up!"; $$; SELECT sleep(2); - -- Greg Sabino Mullane greg@turnstep.com PGP Key: 0x14964AC8 200508211601 http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8 -----BEGIN PGP SIGNATURE----- iD8DBQFDCN3BvJuQZxSWSsgRAhtJAKD0QDRWb6kk+AGWHMPQqM7lwRAXKACgpHM0 EkA+7aOQoI3BzgLhkva53mQ= =hD9m -----END PGP SIGNATURE----- From banderson@presinet.com Sun Aug 21 23:33:55 2005 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 53482D6DA8 for ; Sun, 21 Aug 2005 20:33:55 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 91160-01 for ; Sun, 21 Aug 2005 23:33:47 +0000 (GMT) Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 7FA59D76AD for ; Sun, 21 Aug 2005 20:33:15 -0300 (ADT) Received: from presinet.com (presinet.com [209.53.156.1]) by svr2.postgresql.org (Postfix) with ESMTP id 2F486F1206 for ; Sun, 21 Aug 2005 21:22:16 +0100 (BST) Received: from [10.10.1.204] ([10.10.1.204]) by presinet.com with Microsoft SMTPSVC(6.0.3790.211); Sun, 21 Aug 2005 13:25:32 -0700 Message-ID: <4308E366.5020608@presinet.com> Date: Sun, 21 Aug 2005 13:26:14 -0700 From: Bricklen Anderson User-Agent: Debian Thunderbird 1.0.2 (X11/20050602) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Don Drake Cc: pgsql-admin@postgresql.org Subject: Re: sleep? References: <6c21003b050821122278e3d7d5@mail.gmail.com> In-Reply-To: <6c21003b050821122278e3d7d5@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 21 Aug 2005 20:25:32.0343 (UTC) FILETIME=[7AA99C70:01C5A68E] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.011 required=5 tests=[AWL=0.011] X-Spam-Level: X-Archive-Number: 200508/256 X-Sequence-Number: 18575 Don Drake wrote: > Is there a sleep function in plpgsql? I need to wait a period time (60 > seconds) in a while loop. > > I didn't see anything in the docs. > > Thanks. > > -Don > create or replace function sleep(integer) returns void as $$ return sleep(shift) $$ language plperlu immutable strict; select sleep(5); --(sleeps for 5 seconds) From gbarosio@gmail.com Sun Aug 21 21:09:51 2005 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B3777D6D84 for ; Sun, 21 Aug 2005 18:09:51 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 38343-06 for ; Sun, 21 Aug 2005 21:09:48 +0000 (GMT) Received: from nproxy.gmail.com (nproxy.gmail.com [64.233.182.194]) by svr1.postgresql.org (Postfix) with ESMTP id 47356D6D80 for ; Sun, 21 Aug 2005 18:09:47 -0300 (ADT) Received: by nproxy.gmail.com with SMTP id c2so155392nfe for ; Sun, 21 Aug 2005 14:09:49 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=L8Uu7C9CQXhVNvLk0Mwx+INZmXdb97HBI+/VJT7kMdK0diDFcPh5kzPQ4d7VAsegGG0ueBTiiBHLpYOpLu0x7n8ezCncLNbcp29R/QZrWJXl0abbHnGHLTPR5fitvY9sRwvkkEKp2DaIlfAqTPr5W1jV0q2mgIsI82GAFjyFfd8= Received: by 10.48.161.20 with SMTP id j20mr110252nfe; Sun, 21 Aug 2005 14:09:49 -0700 (PDT) Received: by 10.48.144.16 with HTTP; Sun, 21 Aug 2005 14:09:49 -0700 (PDT) Message-ID: Date: Sun, 21 Aug 2005 22:09:49 +0100 From: Guido Barosio To: Don Drake Subject: Re: sleep? Cc: pgsql-admin@postgresql.org In-Reply-To: <6c21003b050821122278e3d7d5@mail.gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_7753_32090963.1124658589081" References: <6c21003b050821122278e3d7d5@mail.gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.183 required=5 tests=[AWL=0.063, HTML_50_60=0.095, HTML_MESSAGE=0.001, RCVD_BY_IP=0.024] X-Spam-Level: X-Archive-Number: 200508/253 X-Sequence-Number: 18572 ------=_Part_7753_32090963.1124658589081 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Don't know about such thing, but I guess that a plpgsql function could help= =20 using datetime var's. Just a guess, don't know if the optimal solution. Best wishes, G.- On 8/21/05, Don Drake wrote:=20 >=20 > Is there a sleep function in plpgsql? I need to wait a period time (60=20 > seconds) in a while loop. >=20 > I didn't see anything in the docs. >=20 > Thanks. >=20 > -Don >=20 > --=20 > Donald Drake > President > Drake Consulting > http://www.drakeconsult.com/ > http://www.MailLaunder.com/ > http://www.mobilemeridian.com/ > 312-560-1574 >=20 >=20 --=20 "Adopting the position that you are smarter than an automatic optimization algorithm is generally a good way to achieve less performance, not more" - Tom Lane. ------=_Part_7753_32090963.1124658589081 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
Don't know about such thing, but I guess that a plpgsql function could= help using datetime var's.
 
Just a guess, don't know if the optimal solution.
 
Best wishes,
G.-

 



--
"Adopting the position that = you are smarter than an automatic
optimization algorithm is generally a = good way to achieve less
performance, not more" - Tom Lane.=20 ------=_Part_7753_32090963.1124658589081-- From mike@fuhr.org Sun Aug 21 22:41:40 2005 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 69FDED6D84 for ; Sun, 21 Aug 2005 19:41:40 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 68358-07 for ; Sun, 21 Aug 2005 22:41:39 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id 836B1D6D8B for ; Sun, 21 Aug 2005 19:41:37 -0300 (ADT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j7LMfYHt012579 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 21 Aug 2005 16:41:36 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.3/8.13.3) with ESMTP id j7LMfXf7032121; Sun, 21 Aug 2005 16:41:33 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.3/8.13.3/Submit) id j7LMfXCA032120; Sun, 21 Aug 2005 16:41:33 -0600 (MDT) (envelope-from mfuhr) Date: Sun, 21 Aug 2005 16:41:33 -0600 From: Michael Fuhr To: Don Drake Cc: pgsql-admin@postgresql.org Subject: Re: sleep? Message-ID: <20050821224133.GB31904@winnie.fuhr.org> References: <6c21003b050821122278e3d7d5@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6c21003b050821122278e3d7d5@mail.gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.005 required=5 tests=[AWL=0.005] X-Spam-Level: X-Archive-Number: 200508/254 X-Sequence-Number: 18573 On Sun, Aug 21, 2005 at 02:22:25PM -0500, Don Drake wrote: > Is there a sleep function in plpgsql? I need to wait a period time (60 > seconds) in a while loop. SELECT oid::regprocedure FROM pg_proc WHERE proname ILIKE '%sleep%' OR prosrc ILIKE '%sleep%'; oid ----- (0 rows) When I need a sleep function on the server side I write one in C, PL/Perl, PL/Tcl, PL/Python, etc. PostgreSQL 8.0 and later have an internal pg_usleep() function but it's not exposed to the user. I asked about exposing it recently but didn't see any replies (it was in response to a message in pgsql-committers; I suppose I should have asked in pgsql-hackers instead). -- Michael Fuhr From desoi@pgedit.com Mon Aug 22 01:44:13 2005 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3B8DBD7246 for ; Sun, 21 Aug 2005 22:44:13 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 39603-06 for ; Mon, 22 Aug 2005 01:44:09 +0000 (GMT) Received: from a2s4.a2hosting.com (a2s4.a2hosting.com [64.9.205.220]) by svr1.postgresql.org (Postfix) with ESMTP id BB310D7273 for ; Sun, 21 Aug 2005 22:44:07 -0300 (ADT) Received: from user-1120fe1.dsl.mindspring.com ([66.32.61.193] helo=[192.168.1.10]) by a2s4.a2hosting.com with esmtpsa (TLSv1:RC4-SHA:128) (Exim 4.51) id 1E71MB-0005fa-E9; Sun, 21 Aug 2005 21:44:11 -0400 In-Reply-To: References: <6c21003b050821122278e3d7d5@mail.gmail.com> Mime-Version: 1.0 (Apple Message framework v733) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Cc: Don Drake , pgsql-admin@postgresql.org Content-Transfer-Encoding: 7bit From: John DeSoi Subject: Re: sleep? Date: Sun, 21 Aug 2005 21:43:55 -0400 To: Guido Barosio X-Mailer: Apple Mail (2.733) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - a2s4.a2hosting.com X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [0 0] / [47 12] X-AntiAbuse: Sender Address Domain - pgedit.com X-Source: X-Source-Args: X-Source-Dir: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.008 required=5 tests=[AWL=0.008] X-Spam-Level: X-Archive-Number: 200508/257 X-Sequence-Number: 18576 On Aug 21, 2005, at 5:09 PM, Guido Barosio wrote: > Don't know about such thing, but I guess that a plpgsql function > could help using datetime var's. > > Just a guess, don't know if the optimal solution. Yes, you can write one in plpgsql using timeofday, but it is horribly inefficient wastes CPU cycles busy looping. I use the version below for some simple testing, but it is not useful for a production system. It would be nice to have a sleep function that does not require anything beyond plpgsql. John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL create or replace function sleep (integer) returns time as ' declare seconds alias for $1; later time; thetime time; begin thetime := timeofday()::timestamp; later := thetime + (seconds::text || '' seconds'')::interval; loop if thetime >= later then exit; else thetime := timeofday()::timestamp; end if; end loop; return later; end; ' language plpgsql; From dondrake@gmail.com Mon Aug 22 13:34:30 2005 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4012CD6DFB for ; Mon, 22 Aug 2005 10:34:30 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 57437-04 for ; Mon, 22 Aug 2005 13:34:26 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.207]) by svr1.postgresql.org (Postfix) with ESMTP id 8F2DFD6D71 for ; Mon, 22 Aug 2005 10:34:24 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id i4so969133wra for ; Mon, 22 Aug 2005 06:34:29 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=qhmIiad6WVSQrEVIz//8dFgZmPFw2iRzxcaxwJmQjWDPf/CFPzlVl/w0artECK3ZX+TPehwQahRpoVvgyqHENB+x3jsE14GEyUzVvltoF5f36IYzhMxxiWh/2kLexhIMvoEwyEHcDKwI0RWQvfS72ChJyq8xzvvVrlryst0y74U= Received: by 10.54.6.50 with SMTP id 50mr1448756wrf; Mon, 22 Aug 2005 06:34:29 -0700 (PDT) Received: by 10.54.94.11 with HTTP; Mon, 22 Aug 2005 06:34:29 -0700 (PDT) Message-ID: <6c21003b05082206341411de2d@mail.gmail.com> Date: Mon, 22 Aug 2005 08:34:29 -0500 From: Don Drake To: John DeSoi Subject: Re: sleep? Cc: Guido Barosio , pgsql-admin@postgresql.org In-Reply-To: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_22141_28617610.1124717669284" References: <6c21003b050821122278e3d7d5@mail.gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.087 required=5 tests=[AWL=-0.033, HTML_50_60=0.095, HTML_MESSAGE=0.001, RCVD_BY_IP=0.024] X-Spam-Level: X-Archive-Number: 200508/259 X-Sequence-Number: 18578 ------=_Part_22141_28617610.1124717669284 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Thanks for all of the replies. I recompiled my DB with plperlu and am using= =20 perl's sleep function. I agree that a basic function (non-CPU intensive sleep) like this should be= =20 built in. Thanks again. -Don On 8/21/05, John DeSoi wrote: >=20 >=20 > On Aug 21, 2005, at 5:09 PM, Guido Barosio wrote: >=20 > > Don't know about such thing, but I guess that a plpgsql function > > could help using datetime var's. > > > > Just a guess, don't know if the optimal solution. >=20 >=20 > Yes, you can write one in plpgsql using timeofday, but it is horribly > inefficient wastes CPU cycles busy looping. I use the version below > for some simple testing, but it is not useful for a production > system. It would be nice to have a sleep function that does not > require anything beyond plpgsql. >=20 >=20 > John DeSoi, Ph.D. > http://pgedit.com/ > Power Tools for PostgreSQL >=20 >=20 >=20 > create or replace function sleep (integer) returns time as ' > declare > seconds alias for $1; > later time; > thetime time; > begin > thetime :=3D timeofday()::timestamp; > later :=3D thetime + (seconds::text || '' seconds'')::interval; > loop > if thetime >=3D later then > exit; > else > thetime :=3D timeofday()::timestamp; > end if; > end loop; >=20 > return later; > end; > ' language plpgsql; >=20 --=20 Donald Drake President Drake Consulting http://www.drakeconsult.com/ http://www.MailLaunder.com/ http://www.mobilemeridian.com/ 312-560-1574 ------=_Part_22141_28617610.1124717669284 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Thanks for all of the replies.  I recompiled my DB with plperlu and am= using perl's sleep function.

I agree that a basic function (non-CPU intensive sleep) like this should be= built in.

Thanks again.

-Don


On 8/21/05, John DeSoi <desoi@pgedit= .com> wrote:

On Aug 21, 2005, at 5:09 PM, Guido Barosio wrote:

> Don't kno= w about such thing, but I guess that a plpgsql function
> could help = using datetime var's.
>
> Just a guess, don't know if the optim= al solution.


Yes, you can write one in plpgsql using timeofday, but it is ho= rribly
inefficient wastes CPU cycles busy looping. I use the version bel= ow
for some simple testing, but it is not useful for a production
system. It would be nice to have a sleep function that does not
require = anything beyond plpgsql.


John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL



create or replace function sleep (integer) returns time as '
&nb= sp;    declare
       =   seconds alias for $1;
       &= nbsp; later time;
         theti= me time;
     begin
     = ;    thetime :=3D timeofday()::timestamp;
         later :=3D thetime + (= seconds::text || '' seconds'')::interval;
     =     loop
        =      if thetime >=3D later then
   = ;            &n= bsp; exit;
          &= nbsp;  else
         &= nbsp;       thetime :=3D timeofday()::timestamp;
      = ;       end if;
    &n= bsp;    end loop;

      = ;   return later;
     end;
' language = plpgsql;



--
Donald Drak= e
President
Drake Consulting
http://www= .drakeconsult.com/
http://ww= w.MailLaunder.com/
http:/= /www.mobilemeridian.com/
312-560-1574
------=_Part_22141_28617610.1124717669284-- From mike@fuhr.org Mon Aug 22 14:01:41 2005 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4BB1CD6E91 for ; Mon, 22 Aug 2005 11:01:41 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 33930-05 for ; Mon, 22 Aug 2005 14:01:39 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id 2826DD6E7E for ; Mon, 22 Aug 2005 11:01:37 -0300 (ADT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j7ME1Yb7013572 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 22 Aug 2005 08:01:36 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.3/8.13.3) with ESMTP id j7ME1YlM060050; Mon, 22 Aug 2005 08:01:34 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.3/8.13.3/Submit) id j7ME1XGR060049; Mon, 22 Aug 2005 08:01:33 -0600 (MDT) (envelope-from mfuhr) Date: Mon, 22 Aug 2005 08:01:33 -0600 From: Michael Fuhr To: Don Drake Cc: John DeSoi , Guido Barosio , pgsql-admin@postgresql.org Subject: Re: sleep? Message-ID: <20050822140133.GA60020@winnie.fuhr.org> References: <6c21003b050821122278e3d7d5@mail.gmail.com> <6c21003b05082206341411de2d@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6c21003b05082206341411de2d@mail.gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.005 required=5 tests=[AWL=0.005] X-Spam-Level: X-Archive-Number: 200508/260 X-Sequence-Number: 18579 On Mon, Aug 22, 2005 at 08:34:29AM -0500, Don Drake wrote: > I agree that a basic function (non-CPU intensive sleep) like this should be > built in. It's being discussed in pgsql-hackers: http://archives.postgresql.org/pgsql-hackers/2005-08/msg00633.php Do you have any use cases in addition to what's already been mentioned? Sleeping isn't really a database operation, so there needs to be some justification for making it a standard function. -- Michael Fuhr From pgman@candle.pha.pa.us Mon Aug 22 14:24:54 2005 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 97432D6FDA for ; Mon, 22 Aug 2005 11:24:54 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 79173-10 for ; Mon, 22 Aug 2005 14:24:52 +0000 (GMT) Received: from candle.pha.pa.us (candle.pha.pa.us [64.139.89.126]) by svr1.postgresql.org (Postfix) with ESMTP id D566FD6FEC for ; Mon, 22 Aug 2005 11:24:50 -0300 (ADT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id j7MEObk10012; Mon, 22 Aug 2005 10:24:37 -0400 (EDT) From: Bruce Momjian Message-Id: <200508221424.j7MEObk10012@candle.pha.pa.us> Subject: Re: sleep? In-Reply-To: <20050822140133.GA60020@winnie.fuhr.org> To: Michael Fuhr Date: Mon, 22 Aug 2005 10:24:37 -0400 (EDT) Cc: Don Drake , John DeSoi , Guido Barosio , pgsql-admin@postgresql.org X-Mailer: ELM [version 2.4ME+ PL121 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.01 required=5 tests=[AWL=0.010] X-Spam-Level: X-Archive-Number: 200508/261 X-Sequence-Number: 18580 Michael Fuhr wrote: > On Mon, Aug 22, 2005 at 08:34:29AM -0500, Don Drake wrote: > > I agree that a basic function (non-CPU intensive sleep) like this should be > > built in. > > It's being discussed in pgsql-hackers: > > http://archives.postgresql.org/pgsql-hackers/2005-08/msg00633.php > > Do you have any use cases in addition to what's already been > mentioned? Sleeping isn't really a database operation, so there > needs to be some justification for making it a standard function. Well, we needed it for our own regression tests, so I assume others would need it as well. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 From DGoulet@vicr.com Mon Aug 22 15:06:26 2005 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AE5A5D6F6C for ; Mon, 22 Aug 2005 12:06:26 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 13518-01 for ; Mon, 22 Aug 2005 15:06:22 +0000 (GMT) Received: from smtpgate.vicr.com (smtpgate.vicr.com [207.141.187.5]) by svr1.postgresql.org (Postfix) with ESMTP id 2518BD6EC0 for ; Mon, 22 Aug 2005 12:06:21 -0300 (ADT) Received: from 25exch1.vicorpower.vicr.com ([172.20.20.30]) by exchgate.vicorpower.vicr.com with Microsoft SMTPSVC(5.0.2195.6713); Mon, 22 Aug 2005 11:06:03 -0400 X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 Content-Class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: sleep? Date: Mon, 22 Aug 2005 11:06:03 -0400 Message-ID: <4001DEAF7DF9BD498B58B45051FBEA6502BE5AB4@25exch1.vicorpower.vicr.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [ADMIN] sleep? thread-index: AcWnJ+NRUKDYz9lJSk2BCJqPhDE5hgAAoObQ From: "Goulet, Dick" To: "Bruce Momjian" , "Michael Fuhr" Cc: "Don Drake" , "John DeSoi" , "Guido Barosio" , X-OriginalArrivalTime: 22 Aug 2005 15:06:03.0999 (UTC) FILETIME=[03DA2EF0:01C5A72B] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.049 required=5 tests=[AWL=0.049] X-Spam-Level: X-Archive-Number: 200508/264 X-Sequence-Number: 18583 Bruce, Agree that pausing or sleeping is not really a database function, more of a programming function. But Oracle and I understand though I can't find it at the moment SQL*Server do offer this functionality within their DB's just because people do store functions and procedures that are executed as internal database jobs and consequently need this functionality. Not sure about DB2, been too long, but I seem to remember it being there for other reasons though. -----Original Message----- From: pgsql-admin-owner@postgresql.org [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of Bruce Momjian Sent: Monday, August 22, 2005 10:25 AM To: Michael Fuhr Cc: Don Drake; John DeSoi; Guido Barosio; pgsql-admin@postgresql.org Subject: Re: [ADMIN] sleep? Michael Fuhr wrote: > On Mon, Aug 22, 2005 at 08:34:29AM -0500, Don Drake wrote: > > I agree that a basic function (non-CPU intensive sleep) like this should be=20 > > built in. >=20 > It's being discussed in pgsql-hackers: >=20 > http://archives.postgresql.org/pgsql-hackers/2005-08/msg00633.php >=20 > Do you have any use cases in addition to what's already been > mentioned? Sleeping isn't really a database operation, so there > needs to be some justification for making it a standard function. Well, we needed it for our own regression tests, so I assume others would need it as well. --=20 Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 ---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend From tgl@sss.pgh.pa.us Mon Aug 22 15:56:53 2005 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6B2E9D6FAA for ; Mon, 22 Aug 2005 12:56:53 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 62705-10 for ; Mon, 22 Aug 2005 15:56:50 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id E5321D6DA1 for ; Mon, 22 Aug 2005 12:56:49 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j7MFudpe016419; Mon, 22 Aug 2005 11:56:39 -0400 (EDT) To: Bruce Momjian Cc: Michael Fuhr , Don Drake , John DeSoi , Guido Barosio , pgsql-admin@postgresql.org Subject: Re: sleep? In-reply-to: <200508221424.j7MEObk10012@candle.pha.pa.us> References: <200508221424.j7MEObk10012@candle.pha.pa.us> Comments: In-reply-to Bruce Momjian message dated "Mon, 22 Aug 2005 10:24:37 -0400" Date: Mon, 22 Aug 2005 11:56:39 -0400 Message-ID: <16418.1124726199@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 required=5 tests=[AWL=0.006] X-Spam-Level: X-Archive-Number: 200508/267 X-Sequence-Number: 18586 Bruce Momjian writes: > Michael Fuhr wrote: >> Do you have any use cases in addition to what's already been >> mentioned? Sleeping isn't really a database operation, so there >> needs to be some justification for making it a standard function. > Well, we needed it for our own regression tests, so I assume others > would need it as well. ... and you'll notice that the regression test that uses it is still failing intermittently on some of the buildfarm machines, which rather calls the whole approach into question ... regards, tom lane From pgman@candle.pha.pa.us Mon Aug 22 16:24:32 2005 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 99C22D70A4 for ; Mon, 22 Aug 2005 13:24:32 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 69433-01 for ; Mon, 22 Aug 2005 16:24:29 +0000 (GMT) Received: from candle.pha.pa.us (candle.pha.pa.us [64.139.89.126]) by svr1.postgresql.org (Postfix) with ESMTP id 5EC51D707F for ; Mon, 22 Aug 2005 13:24:27 -0300 (ADT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id j7MGOHg12583; Mon, 22 Aug 2005 12:24:17 -0400 (EDT) From: Bruce Momjian Message-Id: <200508221624.j7MGOHg12583@candle.pha.pa.us> Subject: Re: sleep? In-Reply-To: <16418.1124726199@sss.pgh.pa.us> To: Tom Lane Date: Mon, 22 Aug 2005 12:24:17 -0400 (EDT) Cc: Michael Fuhr , Don Drake , John DeSoi , Guido Barosio , pgsql-admin@postgresql.org X-Mailer: ELM [version 2.4ME+ PL121 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.01 required=5 tests=[AWL=0.010] X-Spam-Level: X-Archive-Number: 200508/266 X-Sequence-Number: 18585 Tom Lane wrote: > Bruce Momjian writes: > > Michael Fuhr wrote: > >> Do you have any use cases in addition to what's already been > >> mentioned? Sleeping isn't really a database operation, so there > >> needs to be some justification for making it a standard function. > > > Well, we needed it for our own regression tests, so I assume others > > would need it as well. > > ... and you'll notice that the regression test that uses it is still > failing intermittently on some of the buildfarm machines, which rather > calls the whole approach into question ... It means that our use of sleep() wasn't the fix, but we need it to try, didn't we? -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 From dondrake@gmail.com Tue Aug 23 14:42:28 2005 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7E418D6F14 for ; Tue, 23 Aug 2005 11:42:28 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 84103-01 for ; Tue, 23 Aug 2005 14:42:25 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.194]) by svr1.postgresql.org (Postfix) with ESMTP id E5FB0D6E2A for ; Tue, 23 Aug 2005 11:42:23 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id i17so3486wra for ; Tue, 23 Aug 2005 07:42:28 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=WaIQmH1IN+apIoj8CWfVNX6OQYlBiUwrrmkG4hJxewpFGdANDXZd7LSojnCivXAFn0QxdVRjG4m+Hh1jYkoCWumy5UA+IZ9JuGcnVqDNgjYYqyEv5YNke6OmQRpIgH5PydxAdjj7m2UX0Woj0dyKwQGZtubkKXt1HWg9w8cFHuI= Received: by 10.54.135.20 with SMTP id i20mr2292458wrd; Tue, 23 Aug 2005 07:42:28 -0700 (PDT) Received: by 10.54.94.11 with HTTP; Tue, 23 Aug 2005 07:42:27 -0700 (PDT) Message-ID: <6c21003b05082307427ea67279@mail.gmail.com> Date: Tue, 23 Aug 2005 09:42:27 -0500 From: Don Drake To: Michael Fuhr Subject: Re: sleep? Cc: John DeSoi , Guido Barosio , pgsql-admin@postgresql.org In-Reply-To: <20050822140133.GA60020@winnie.fuhr.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_4034_26651.1124808147967" References: <6c21003b050821122278e3d7d5@mail.gmail.com> <6c21003b05082206341411de2d@mail.gmail.com> <20050822140133.GA60020@winnie.fuhr.org> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.07 required=5 tests=[AWL=-0.011, HTML_30_40=0.056, HTML_MESSAGE=0.001, RCVD_BY_IP=0.024] X-Spam-Level: X-Archive-Number: 200508/282 X-Sequence-Number: 18601 ------=_Part_4034_26651.1124808147967 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Sorry for the delay in replying. The use-case that I have is the following. I'm writing a job-control=20 tracking sub-system that will store when jobs are started, finished, failed= ,=20 etc. I would like to have the ability to have a process that is requesting= =20 to start, to actually wait a specified period time before starting. It coul= d=20 wait for another job to finish. I'm writing this in plpgsql since I'm=20 storing status in the db. -Don On 8/22/05, Michael Fuhr wrote: >=20 > On Mon, Aug 22, 2005 at 08:34:29AM -0500, Don Drake wrote: > > I agree that a basic function (non-CPU intensive sleep) like this shoul= d=20 > be > > built in. >=20 > It's being discussed in pgsql-hackers: >=20 > http://archives.postgresql.org/pgsql-hackers/2005-08/msg00633.php >=20 > Do you have any use cases in addition to what's already been > mentioned? Sleeping isn't really a database operation, so there > needs to be some justification for making it a standard function. >=20 > -- > Michael Fuhr >=20 --=20 Donald Drake President Drake Consulting http://www.drakeconsult.com/ http://www.MailLaunder.com/ http://www.mobilemeridian.com/ 312-560-1574 ------=_Part_4034_26651.1124808147967 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Sorry for the delay in replying.

The use-case that I have is the following.  I'm writing a job-control tracking sub-system  that will store when jobs are started, finished, failed, etc.  I would like to have the ability to have a process that is requesting to start, to actually wait a specified period time before starting.  It could wait for another job to finish.  I'm writing this in plpgsql since I'm storing status in the db.

-Don

On 8/22/05, Michael Fuhr <mike@fuhr= .org> wrote:
On Mon, Aug 22, 2005 at 08:34:29AM -0500, Don Drake wrote:
> I agree = that a basic function (non-CPU intensive sleep) like this should be
>= built in.

It's being discussed in pgsql-hackers:

http://archives.postgresql.org/pgsql-hackers/2005-08/msg00633.php
Do you have any use cases in addition to what's already been
mentioned= ?  Sleeping isn't really a database operation, so there
needs = to be some justification for making it a standard function.

--
Michael Fuhr



= --
Donald Drake
President
Drake Consulting
http://www.drakeconsult.com/
http://www.MailLaunder.com/
http://www.mobilemeridian.com/
312-560-1574
------=_Part_4034_26651.1124808147967-- From jd@commandprompt.com Tue Aug 23 15:07:16 2005 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8B8EED6FB1 for ; Tue, 23 Aug 2005 12:07:16 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 10562-10 for ; Tue, 23 Aug 2005 15:06:42 +0000 (GMT) Received: from hosting.commandprompt.com (128.commandprompt.com [207.173.200.128]) by svr1.postgresql.org (Postfix) with ESMTP id 20CACD6F89 for ; Tue, 23 Aug 2005 12:06:41 -0300 (ADT) Received: from [192.168.1.100] (clbb-248.saw.net [64.146.135.248]) (authenticated bits=0) by hosting.commandprompt.com (8.13.4/8.13.4) with ESMTP id j7NF4Yfo005708; Tue, 23 Aug 2005 08:04:34 -0700 Message-ID: <430B3BBC.7010607@commandprompt.com> Date: Tue, 23 Aug 2005 08:07:40 -0700 From: "Joshua D. Drake" User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050727) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Don Drake Cc: Michael Fuhr , John DeSoi , Guido Barosio , pgsql-admin@postgresql.org Subject: Re: sleep? References: <6c21003b050821122278e3d7d5@mail.gmail.com> <6c21003b05082206341411de2d@mail.gmail.com> <20050822140133.GA60020@winnie.fuhr.org> <6c21003b05082307427ea67279@mail.gmail.com> In-Reply-To: <6c21003b05082307427ea67279@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by milter-greylist-1.6 (hosting.commandprompt.com [192.168.1.101]); Tue, 23 Aug 2005 08:04:35 -0700 (PDT) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.023 required=5 tests=[AWL=0.023] X-Spam-Level: X-Archive-Number: 200508/283 X-Sequence-Number: 18602 Don Drake wrote: > Sorry for the delay in replying. > > The use-case that I have is the following. I'm writing a job-control > tracking sub-system that will store when jobs are started, finished, > failed, etc. I would like to have the ability to have a process that > is requesting to start, to actually wait a specified period time > before starting. It could wait for another job to finish. I'm > writing this in plpgsql since I'm storing status in the db. I would write a userspace daemon that ran outside of PostgreSQL to call your procedures as you need them to run. Sincerely, Joshua D. Drake From jnasby@pervasive.com Tue Aug 23 18:34:43 2005 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 47C54D70FB for ; Tue, 23 Aug 2005 15:34:43 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 15753-02 for ; Tue, 23 Aug 2005 18:34:37 +0000 (GMT) Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) by svr1.postgresql.org (Postfix) with ESMTP id 71BAFD6FEF for ; Tue, 23 Aug 2005 15:34:36 -0300 (ADT) Received: by flake.decibel.org (Postfix, from userid 1001) id 10D05152A1; Tue, 23 Aug 2005 13:34:36 -0500 (CDT) Date: Tue, 23 Aug 2005 13:34:36 -0500 From: "Jim C. Nasby" To: Don Drake Cc: Michael Fuhr , John DeSoi , Guido Barosio , pgsql-admin@postgresql.org Subject: Re: sleep? Message-ID: <20050823183436.GM43820@pervasive.com> References: <6c21003b050821122278e3d7d5@mail.gmail.com> <6c21003b05082206341411de2d@mail.gmail.com> <20050822140133.GA60020@winnie.fuhr.org> <6c21003b05082307427ea67279@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6c21003b05082307427ea67279@mail.gmail.com> X-Operating-System: FreeBSD 4.11-RELEASE-p10 i386 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 required=5 tests=[none] X-Spam-Level: X-Archive-Number: 200508/289 X-Sequence-Number: 18608 On a related note, you might be interested in http://pgfoundry.org/projects/pgjob/ On Tue, Aug 23, 2005 at 09:42:27AM -0500, Don Drake wrote: > Sorry for the delay in replying. > > The use-case that I have is the following. I'm writing a job-control > tracking sub-system that will store when jobs are started, finished, failed, > etc. I would like to have the ability to have a process that is requesting > to start, to actually wait a specified period time before starting. It could > wait for another job to finish. I'm writing this in plpgsql since I'm > storing status in the db. > > -Don > > On 8/22/05, Michael Fuhr wrote: > > > > On Mon, Aug 22, 2005 at 08:34:29AM -0500, Don Drake wrote: > > > I agree that a basic function (non-CPU intensive sleep) like this should > > be > > > built in. > > > > It's being discussed in pgsql-hackers: > > > > http://archives.postgresql.org/pgsql-hackers/2005-08/msg00633.php > > > > Do you have any use cases in addition to what's already been > > mentioned? Sleeping isn't really a database operation, so there > > needs to be some justification for making it a standard function. > > > > -- > > Michael Fuhr > > > > > > -- > Donald Drake > President > Drake Consulting > http://www.drakeconsult.com/ > http://www.MailLaunder.com/ > http://www.mobilemeridian.com/ > 312-560-1574 -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com 512-569-9461