X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4E6F05293B for ; Tue, 28 Jun 2005 11:53:21 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 45724-10 for ; Tue, 28 Jun 2005 14:53:18 +0000 (GMT) Received: from mail25.sea5.speakeasy.net (mail25.sea5.speakeasy.net [69.17.117.27]) by svr1.postgresql.org (Postfix) with ESMTP id 770C652833 for ; Tue, 28 Jun 2005 11:53:17 -0300 (ADT) Received: (qmail 26228 invoked from network); 28 Jun 2005 14:53:22 -0000 Received: from dsl093-114-095.chi2.dsl.speakeasy.net (HELO mofo.meme.com) ([66.93.114.95]) (envelope-sender ) by mail25.sea5.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 28 Jun 2005 14:53:21 -0000 Received: from mofo (localhost.localdomain [127.0.0.1]) by mofo.meme.com (Postfix) with ESMTP id 656D56E421 for ; Tue, 28 Jun 2005 10:42:32 -0500 (CDT) Date: Tue, 28 Jun 2005 15:42:32 +0000 From: "Karl O. Pinc" Subject: Fwd: Re: [PERFORM] Performance analysis of plpgsql code [kop@meme.com] To: pgsql-patches@postgresql.org References: <1119915045l.4428l.5l@mofo> <20050627233303.GA17069@winnie.fuhr.org> <1119923648l.11411l.0l@mofo> <20050628013419.GA17407@winnie.fuhr.org> <1119927786l.11411l.3l@mofo> In-Reply-To: <1119927786l.11411l.3l@mofo> (from kop@meme.com on Mon Jun 27 22:03:06 2005) X-Mailer: Balsa 2.3.0 Message-Id: <1119973352l.20199l.4l@mofo> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; DelSp=Yes; Format=Flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/551 X-Sequence-Number: 16283 On 06/27/2005 10:03:06 PM, Karl O. Pinc wrote: On 06/27/2005 08:34:19 PM, Michael Fuhr wrote: > On Tue, Jun 28, 2005 at 01:54:08AM +0000, Karl O. Pinc wrote: > > On 06/27/2005 06:33:03 PM, Michael Fuhr wrote: > > > > >See timeofday(). > > > > That only gives you the time at the start of the transaction, > > so you get no indication of how long anything in the > > transaction takes. > > Did you read the documentation or try it? Perhaps you're thinking > of now(), current_timestamp, and friends, which don't advance during > a transaction; but as the documentation states, "timeofday() returns > the wall-clock time and does advance during transactions." Very sorry. I did not read through the complete documentation. > I just ran tests on versions of PostgreSQL going back to 7.2.8 and > in all of them timeofday() advanced during a transaction. For all your work a documentation patch is appended that I think is easier to read and might avoid this problem in the future. If you don't read all the way through the current cvs version then you might think, as I did, that timeofday() is a CURRENT_TIMESTAMP related function. Sorry, but 3 lines wrap in the patch in my email client. :( Karl Free Software: "You don't pay back, you pay forward." -- Robert A. Heinlein --- func.sgml 2005-06-26 17:05:35.000000000 -0500 +++ func.sgml.new 2005-06-27 21:51:05.301097896 -0500 @@ -5787,15 +5787,6 @@ - There is also the function timeofday(), which for historical - reasons returns a text string rather than a timestamp value: - -SELECT timeofday(); -Result: Sat Feb 17 19:07:32.000126 2001 EST - - - - It is important to know that CURRENT_TIMESTAMP and related functions return the start time of the current transaction; their values do not @@ -5803,8 +5794,7 @@ the intent is to allow a single transaction to have a consistent notion of the current time, so that multiple modifications within the same transaction bear the same - time stamp. timeofday() - returns the wall-clock time and does advance during transactions. + time stamp. @@ -5815,6 +5805,18 @@ + There is also the function timeofday() which + returns the wall-clock time and advances during transactions. For + historical reasons timeofday() returns a + text string rather than a timestamp + value: + +SELECT timeofday(); +Result: Sat Feb 17 19:07:32.000126 2001 EST + + + + All the date/time data types also accept the special literal value now to specify the current date and time. Thus, the following three all return the same result: ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster Karl Free Software: "You don't pay back, you pay forward." -- Robert A. Heinlein