Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id C93736324A7 for ; Mon, 12 Jul 2010 08:15:11 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 36744-02 for ; Mon, 12 Jul 2010 11:15:04 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.171]) by mail.postgresql.org (Postfix) with ESMTP id 7F349632AC3 for ; Mon, 12 Jul 2010 08:15:04 -0300 (ADT) Received: from webserv.wug.de ([194.25.154.138]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0Luahc-1PG1vJ33C4-0107jZ; Mon, 12 Jul 2010 13:15:02 +0200 Received: from kretschmer by webserv.wug.de with local (Exim 3.36 #1) id 1OYGyS-0002LS-00 for pgsql-performance@postgresql.org; Mon, 12 Jul 2010 13:15:00 +0200 Date: Mon, 12 Jul 2010 13:15:00 +0200 From: "A. Kretschmer" To: pgsql-performance@postgresql.org Subject: Re: now() gives same time within the session Message-ID: <20100712111500.GA14489@a-kretschmer.de> References: <418EC9BD4D7125488CCAC5C7C559A24803A9D0@MS10.lsc.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <418EC9BD4D7125488CCAC5C7C559A24803A9D0@MS10.lsc.net> X-OS: Debian/GNU Linux - weil ich es mir Wert bin! User-Agent: Mutt/1.5.9i X-Provags-ID: V02:K0:7VlE6aK81mwtYNzOaY0/msRE/b/4TH0PaO17QJCf/lV nE1Qt519xggv2RcnOJv79PJOR/8zWAXep+fA8EF3snba/sthND hTE0VmJXd/Add4PLkkSB7kwhzFb+nVCNxdoE1f0lPCrE1ZdQNg LUKVSDsAZpCkQS/SJBqdYAgAG248gEn4VdDIobiUGFIZSO6N4w A5cOEufKg4MxqD/qB6XdA== X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.81 tagged_above=-10 required=5 tests=BAYES_50=0.8, RCVD_IN_DNSWL_NONE=-0.0001, T_FRT_CONTACT=0.01 X-Spam-Level: X-Archive-Number: 201007/185 X-Sequence-Number: 39574 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