Re: Two TIMESTAMPs in one pl/sql function

From: Richard Huxton <dev(at)archonet(dot)com>
To: "Rison, Stuart" <srison(at)rvc(dot)ac(dot)uk>, "'pgsql-sql(at)postgresql(dot)org'" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Two TIMESTAMPs in one pl/sql function
Date: 2002-11-26 15:24:05
Message-ID: 200211261524.06002.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Tuesday 26 Nov 2002 1:54 pm, Rison, Stuart wrote:
> Hi,
>
> I'm trying to time a pl/sql function using a rougn and ready method,
> basically: print a TIMESTAMP at the begining of the function, print a
> TIMESTAMP at the end of the function.
[snip]
> Gives me:
>
> testdb2=# select timer();
> NOTICE: Start: 2002-11-26 13:40:14.116605+00
> NOTICE: End: 2002-11-26 13:40:14.116605+00

> I've tried all sorts of variations but I hit one of two problems; either
> the TIMESTAMP is fixed to the function compile time or, as above, the
> timer1 and timer2 TIMESTAMPs are always identical.

Try timeofday() not now(). Quite often you want the time to stay fixed for the
length of a transaction (what now() does). In this case you don't - see the
Functions : date/time section of the manual for details.

--
Richard Huxton

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Richard Huxton 2002-11-26 15:26:37 Re: help on sql query
Previous Message Dan Langille 2002-11-26 15:17:26 Re: subselect instead of a view...