Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id F2A12476777 for ; Wed, 11 Dec 2002 05:42:36 -0500 (EST) Received: from bragi.msys.ch (bragi.msys.ch [157.161.101.6]) by postgresql.org (Postfix) with ESMTP id 0E412476A01 for ; Wed, 11 Dec 2002 05:42:12 -0500 (EST) Received: from msys.ch (idun [157.161.101.130]) by bragi.msys.ch (8.12.3/8.12.3/SuSE Linux 0.6) with ESMTP id gBBAgCoO025186 for ; Wed, 11 Dec 2002 11:42:13 +0100 Message-ID: <3DF71684.5080208@msys.ch> Date: Wed, 11 Dec 2002 11:42:12 +0100 From: Beatrice Yueksel User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US; rv:0.9.4) Gecko/20011022 Netscape6/6.2 X-Accept-Language: en-us MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Problem with timestamp Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/123 X-Sequence-Number: 10711 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';