Re: Logging duration of batch runs

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Christian Kratzer <ck(at)cksoft(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Logging duration of batch runs
Date: 2004-06-23 11:34:32
Message-ID: 20040623113428.GC13130@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Jun 23, 2004 at 12:49:19PM +0200, Christian Kratzer wrote:
> Hi,
>
> I have a stored procedure run periodically that assign accounting records
> to their respective customers based on username and other criteria.
> It also does all kinds of validation work on the accounting records.
>
> I would have liked to have the procedure log start and stop times
> using RAISE NOTICE and also store start and stop time of each run
> to a logging table.

<snip>

> the problem is that start_time and stop_time are identical.
>
> Is there any way I can get plpgsql to reevaluate now at the end
> of the batch ???

You want timeofday(), not now(). Now() is transaction time, timeofday()
is the real current time.

Hope this helps,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2004-06-23 11:40:46 Re: Logging duration of batch runs
Previous Message Jim Seymour 2004-06-23 11:28:37 Re: Do we need more emphasis on backup?