Re: Problem with timestamp

From: "Henshall, Stuart - Design & Print" <SHenshall(at)westcountry-design-print(dot)co(dot)uk>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Problem with timestamp
Date: 2002-12-11 11:03:49
Message-ID: E382B5D8EDE1D6118DBE0008C759BCD6116B19@WCPEXCHANGE
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-sql by date

  From Date Subject
Next Message Frank Bax 2002-12-11 15:57:37 Re: Backup to data base how ?
Previous Message Beatrice Yueksel 2002-12-11 10:42:12 Problem with timestamp