pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedsleep function
6+ messages / 4 participants
[nested] [flat]
* sleep function
@ 2004-08-10 14:05 John DeSoi <jd@icx.net>
2004-08-10 14:57 ` Re: sleep function Bruce Momjian <pgman@candle.pha.pa.us>
0 siblings, 1 reply; 6+ messages in thread
From: John DeSoi @ 2004-08-10 14:05 UTC (permalink / raw)
To: pgsql-sql
Is there a sleep function of some kind? I wanted to simulate a query
taking a long time to execute for testing purposes.
Thanks,
John DeSoi, Ph.D.
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: sleep function
2004-08-10 14:05 sleep function John DeSoi <jd@icx.net>
@ 2004-08-10 14:57 ` Bruce Momjian <pgman@candle.pha.pa.us>
2004-08-11 19:47 ` Re: sleep function John DeSoi <jd@icx.net>
0 siblings, 1 reply; 6+ messages in thread
From: Bruce Momjian @ 2004-08-10 14:57 UTC (permalink / raw)
To: John DeSoi <jd@icx.net>; +Cc: pgsql-sql
John DeSoi wrote:
> Is there a sleep function of some kind? I wanted to simulate a query
> taking a long time to execute for testing purposes.
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.
--
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
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: sleep function
2004-08-10 14:05 sleep function John DeSoi <jd@icx.net>
2004-08-10 14:57 ` Re: sleep function Bruce Momjian <pgman@candle.pha.pa.us>
@ 2004-08-11 19:47 ` John DeSoi <jd@icx.net>
2004-08-23 03:52 ` Re: sleep function Greg Stark <gsstark@mit.edu>
0 siblings, 1 reply; 6+ messages in thread
From: John DeSoi @ 2004-08-11 19:47 UTC (permalink / raw)
To: pgsql-sql
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.
Best,
John DeSoi, Ph.D.
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;
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: sleep function
2004-08-10 14:05 sleep function John DeSoi <jd@icx.net>
2004-08-10 14:57 ` Re: sleep function Bruce Momjian <pgman@candle.pha.pa.us>
2004-08-11 19:47 ` Re: sleep function John DeSoi <jd@icx.net>
@ 2004-08-23 03:52 ` Greg Stark <gsstark@mit.edu>
2004-08-23 13:36 ` Re: sleep function John DeSoi <jd@icx.net>
2004-09-15 09:22 ` Re: sleep function Sanjay Singh <sanjjay@igcar.ernet.in>
0 siblings, 2 replies; 6+ messages in thread
From: Greg Stark @ 2004-08-23 03:52 UTC (permalink / raw)
To: John DeSoi <jd@icx.net>; +Cc: pgsql-sql
John DeSoi <jd@icx.net> 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
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: sleep function
2004-08-10 14:05 sleep function John DeSoi <jd@icx.net>
2004-08-10 14:57 ` Re: sleep function Bruce Momjian <pgman@candle.pha.pa.us>
2004-08-11 19:47 ` Re: sleep function John DeSoi <jd@icx.net>
2004-08-23 03:52 ` Re: sleep function Greg Stark <gsstark@mit.edu>
@ 2004-08-23 13:36 ` John DeSoi <jd@icx.net>
1 sibling, 0 replies; 6+ messages in thread
From: John DeSoi @ 2004-08-23 13:36 UTC (permalink / raw)
To: Greg Stark <gsstark@mit.edu>; +Cc: pgsql-sql
Hi Greg,
On Aug 22, 2004, at 11:52 PM, Greg Stark wrote:
> test=# create or replace function sleep(integer) returns integer as
> 'return sleep(shift)' language plperlu;
> CREATE FUNCTION
>
The original request was for something in built-in to PostgreSQL. I
have not used plperl (or any of the other pl languages), but I assume
there will be additional installation and configuration issues to use
them. But thanks for the example, it will be helpful if I need
something more processor friendly.
Best,
John DeSoi, Ph.D.
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: sleep function
2004-08-10 14:05 sleep function John DeSoi <jd@icx.net>
2004-08-10 14:57 ` Re: sleep function Bruce Momjian <pgman@candle.pha.pa.us>
2004-08-11 19:47 ` Re: sleep function John DeSoi <jd@icx.net>
2004-08-23 03:52 ` Re: sleep function Greg Stark <gsstark@mit.edu>
@ 2004-09-15 09:22 ` Sanjay Singh <sanjjay@igcar.ernet.in>
1 sibling, 0 replies; 6+ messages in thread
From: Sanjay Singh @ 2004-09-15 09:22 UTC (permalink / raw)
To: Greg Stark <gsstark@mit.edu>; +Cc: John DeSoi <jd@icx.net>; pgsql-sql
Hi All,
I am getting this message while I am trying to implement tsearch.
java.sql.SQLException: ERROR: could not find tsearch config by locale
what could be the problem
Please help
bye
Sanjay
Greg Stark wrote:
> John DeSoi <jd@icx.net> 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
>
>
--
Sanjay Singh
*********************************************
| Scientific Officer / D, |
| Library & Information Services, |
| Indira Gandhi Centre for Atomic Research, |
| Kalpakkam - 603102, Tamil Nadu (India) |
| Phone : 0091 4114 280096(O) |
| 0091 9894258801(R) |
| Email : sanjjay@igcar.ernet.in |
| sanjjay_in@yahoo.com |
*********************************************
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2004-09-15 09:22 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-08-10 14:05 sleep function John DeSoi <jd@icx.net>
2004-08-10 14:57 ` Bruce Momjian <pgman@candle.pha.pa.us>
2004-08-11 19:47 ` John DeSoi <jd@icx.net>
2004-08-23 03:52 ` Greg Stark <gsstark@mit.edu>
2004-08-23 13:36 ` John DeSoi <jd@icx.net>
2004-09-15 09:22 ` Sanjay Singh <sanjjay@igcar.ernet.in>
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