X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E35475E3632 for ; Mon, 23 Aug 2004 00:52:02 -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 19428-04 for ; Mon, 23 Aug 2004 03:52:06 +0000 (GMT) Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) by svr1.postgresql.org (Postfix) with ESMTP id 47DDF5E3639 for ; Mon, 23 Aug 2004 00:51:57 -0300 (ADT) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1Bz5sH-0008FQ-00; Sun, 22 Aug 2004 23:52:01 -0400 To: John DeSoi Cc: PostgreSQL Subject: Re: sleep function References: <200408101457.i7AEvvc15187@candle.pha.pa.us> <46D44C5D-EBCF-11D8-A1CD-000A95B03262@icx.net> In-Reply-To: <46D44C5D-EBCF-11D8-A1CD-000A95B03262@icx.net> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 22 Aug 2004 23:52:01 -0400 Message-ID: <87hdqu5x5q.fsf@stark.xeocode.com> Lines: 42 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200408/236 X-Sequence-Number: 18733 John DeSoi writes: > On Aug 10, 2004, at 10:57 AM, Bruce Momjian wrote: > > > I can't think of one, no. I think you will have to use one of the > > server-side languages and call a sleep in there. > > This is no good in the real world since it pounds the CPU, but it worked well > enough for my testing purposes. You went the long way around. I think what he meant was something as simple as: bash-2.05b$ /usr/lib/postgresql/bin/createlang -U postgres plperlu test bash-2.05b$ psql -d test -U postgres Welcome to psql 7.4.2, the PostgreSQL interactive terminal. Type: \copyright for distribution terms \h for help with SQL commands \? for help on internal slash commands \g or terminate with semicolon to execute query \q to quit test=# create or replace function sleep(integer) returns integer as 'return sleep(shift)' language plperlu; CREATE FUNCTION test=# \timing Timing is on. test=# select sleep(10) ; sleep ------- 10 (1 row) Time: 10002.493 ms -- greg