pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Beatrice Yueksel <beatrice@msys.ch>
To: pgsql-sql@postgresql.org
Subject: Problem with timestamp
Date: Wed, 11 Dec 2002 11:42:12 +0100
Message-ID: <3DF71684.5080208@msys.ch> (raw)

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';




view thread (2+ messages)  latest in thread

Message-ID: <3DF71684.5080208@msys.ch>
Permalink:  ../3DF71684.5080208@msys.ch/
Also on:    postgresql.org/message-id/3DF71684.5080208@msys.ch

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: beatrice@msys.ch
  Subject: Re: Problem with timestamp
  In-Reply-To: <3DF71684.5080208@msys.ch>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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