Re: current_timestamp after queries - Mailing list pgsql-general

From Guido Staub
Subject Re: current_timestamp after queries
Date
Msg-id 3D9977FE.B77F227F@gik.uni-karlsruhe.de
Whole thread Raw
In response to Re: current_timestamp after queries  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: current_timestamp after queries  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-general
timeofday() works better than current_timestamp, but I have to use a CAST-Statement to make it possible to calculate the elapsed time.
What do you mean with change during the statement?
The only change I see after using timeofday() is that the calculated time for doing the query the first time and a second time again differ a llittle bit, although that query1 and query2 are equal in the transaction and that I've used the same relation.
Guido Staub

Bruce Momjian schrieb:

Yes, timeofday() will work, but it can change during the statement, right?

---------------------------------------------------------------------------

Martijn van Oosterhout wrote:
> On Mon, Sep 30, 2002 at 11:44:17AM +0200, Guido Staub wrote:
>
> [some current_timestamp stuff]
>
> > I think that the accuracy is not good enough because I've started two
> > BEGIN statements and some time is elapsing between them. Am I right?
> > Or does anybody know a better solution to store the elapsed time after
> > some queries without writing some code in C or JAVA?
>
> Perhaps you're looking for timeofday()?
>
> kleptog=# begin; select timeofday(); select timeofday(); commit;
> BEGIN
>               timeofday
> -------------------------------------
>  Mon Sep 30 19:54:41.559605 2002 EST
> (1 row)
>
>               timeofday
> -------------------------------------
>  Mon Sep 30 19:54:41.560018 2002 EST
> (1 row)
>
> COMMIT
>
> Hope this helps,
> --
> Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> > There are 10 kinds of people in the world, those that can do binary
> > arithmetic and those that can't.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

pgsql-general by date:

Previous
From: Andrey Mosienko
Date:
Subject: Inet arrays in PostgreSQL
Next
From: Oleg Bartunov
Date:
Subject: Re: Inet arrays in PostgreSQL