pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: A. Kretschmer <andreas.kretschmer@schollglas.com>
To: pgsql-performance@postgresql.org
Subject: Re: now() gives same time within the session
Date: Mon, 12 Jul 2010 13:15:00 +0200
Message-ID: <20100712111500.GA14489@a-kretschmer.de> (raw)
In-Reply-To: <418EC9BD4D7125488CCAC5C7C559A24803A9D0@MS10.lsc.net>
References: <418EC9BD4D7125488CCAC5C7C559A24803A9D0@MS10.lsc.net>

In response to Atul.Goel@globaldatapoint.com :
> Hi,
> 
>  
> 
> I need to log the start and end time of the procedures in a table. But the
> start and end time are same. This is how I recreated the issue.
> 
>  
> 
> create table test_time (time timestamp);
> 
> delete from  test_time;
> 
> insert into test_time select now();


Use timeofday() instead, now() returns the transaction starting time.

BEGIN
test=*# select now();
              now
-------------------------------
 2010-07-12 13:13:28.907043+02
(1 row)

test=*# select timeofday();
              timeofday
--------------------------------------
 Mon Jul 12 13:13:36.187703 2010 CEST
(1 row)

test=*# select now();
              now
-------------------------------
 2010-07-12 13:13:28.907043+02
(1 row)

test=*#


Regards, Andreas
-- 
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431  2EB0 389D 1DC2 3172 0C99



view thread (8+ messages)  latest in thread

Message-ID: <20100712111500.GA14489@a-kretschmer.de>
Permalink:  ../20100712111500.GA14489@a-kretschmer.de/
Also on:    postgresql.org/message-id/20100712111500.GA14489@a-kretschmer.de

 · 

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-performance@postgresql.org
  Cc: andreas.kretschmer@schollglas.com
  Subject: Re: now() gives same time within the session
  In-Reply-To: <20100712111500.GA14489@a-kretschmer.de>

* 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