pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: Rison, Stuart <srison@rvc.ac.uk>
To: 'pgsql-sql@postgresql.org' <pgsql-sql@postgresql.org>
Subject: Re: Two TIMESTAMPs in one pl/sql function
Date: Tue, 26 Nov 2002 15:24:05 +0000
Message-ID: <200211261524.06002.dev@archonet.com> (raw)
In-Reply-To: <6BD8CE460CC6EE40B83DDFCED609F84BE140D9@cmnt4008.rvc.ac.uk>
References: <6BD8CE460CC6EE40B83DDFCED609F84BE140D9@cmnt4008.rvc.ac.uk>

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



view thread (2+ messages)

Message-ID: <200211261524.06002.dev@archonet.com>
Permalink:  ../200211261524.06002.dev@archonet.com/
Also on:    postgresql.org/message-id/200211261524.06002.dev@archonet.com

 · 

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: dev@archonet.com, srison@rvc.ac.uk
  Subject: Re: Two TIMESTAMPs in one pl/sql function
  In-Reply-To: <200211261524.06002.dev@archonet.com>

* 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