pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedProblem with timestamp
2+ messages / 2 participants
[nested] [flat]
* Problem with timestamp
@ 2002-12-11 10:42 Beatrice Yueksel <beatrice@msys.ch>
0 siblings, 0 replies; 2+ messages in thread
From: Beatrice Yueksel @ 2002-12-11 10:42 UTC (permalink / raw)
To: pgsql-sql
Hello,
I try to check the time needed by a function.
I would like to :
. select current_timestamp,
. execute 5000 times a function
. select the current_timestamp and return the interval.
Problem : the interval is always '00:00', the two timestamps have always
the same value.
Could you help me ? have you any suggestions for testing sql functions
speed?
Thank you in advance,
Béatrice
create function test_function() returns interval
as '
declare
j integer;
t1 timestamp;
t2 timestamp;
t3 interval;
x integer;
begin
select into t1 now();
FOR j in 0..5000 loop
select into x get_function_to_test();
end loop;
select into t2 now();
t3 := t2 - t1;
RAISE NOTICE '' from % to % = %'',t2,t1,t3;
return t3;
end;
' language 'plpgsql';
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Problem with timestamp
@ 2002-12-11 11:03 Henshall, Stuart - Design & Print <SHenshall@westcountry-design-print.co.uk>
0 siblings, 0 replies; 2+ messages in thread
From: Henshall, Stuart - Design & Print @ 2002-12-11 11:03 UTC (permalink / raw)
To: pgsql-sql
Beatrice Yueksel wrote:
> Hello,
>
> I try to check the time needed by a function.
> I would like to :
> . select current_timestamp,
> . execute 5000 times a function
> . select the current_timestamp and return the interval.
> Problem : the interval is always '00:00', the two timestamps have
> always the same value.
> Could you help me ? have you any suggestions for testing sql functions
> speed?
> Thank you in advance,
> Béatrice
>
>
> create function test_function() returns interval
> as '
> declare
> j integer;
> t1 timestamp;
> t2 timestamp;
> t3 interval;
> x integer;
> begin
> select into t1 now();
> FOR j in 0..5000 loop
> select into x get_function_to_test();
> end loop;
> select into t2 now();
> t3 := t2 - t1;
> RAISE NOTICE '' from % to % = %'',t2,t1,t3;
> return t3;
>
> end;
> ' language 'plpgsql';
>
use timeofday(); as the others have the same value throughout the
transaction
- Stuart
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2002-12-11 11:03 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-12-11 10:42 Problem with timestamp Beatrice Yueksel <beatrice@msys.ch>
2002-12-11 11:03 Re: Problem with timestamp Henshall, Stuart - Design & Print <SHenshall@westcountry-design-print.co.uk>
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