X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id CEF749DCE4C for ; Mon, 20 Mar 2006 19:38:48 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 15507-03 for ; Mon, 20 Mar 2006 19:38:51 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 8D9F49DCE49 for ; Mon, 20 Mar 2006 19:38:46 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id k2KNcjJY009026; Mon, 20 Mar 2006 18:38:45 -0500 (EST) To: Neil Conway cc: Bruce Momjian , Brendan Jurd , pgsql-patches@postgresql.org Subject: Re: Additional current timestamp values In-reply-to: <441F351E.8030203@samurai.com> References: <200603202234.k2KMYOM04077@candle.pha.pa.us> <441F351E.8030203@samurai.com> Comments: In-reply-to Neil Conway message dated "Mon, 20 Mar 2006 18:05:02 -0500" Date: Mon, 20 Mar 2006 18:38:45 -0500 Message-ID: <9025.1142897925@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.113 required=5 tests=[AWL=0.113] X-Spam-Score: 0.113 X-Spam-Level: X-Archive-Number: 200603/220 X-Sequence-Number: 19224 Neil Conway writes: > Bruce Momjian wrote: >> One trick is that these should be the same: >> test=> SELECT statement_timestamp(), transaction_timestamp(); > Should they be? ISTM that the most useful definition of "statement_timestamp" is really "time of arrival of the latest interactive command from the client", and as such it should not be tied to statement start per se at all. I'd be in favor of doing gettimeofday() upon receiving a client message, reporting that value directly for statement_timestamp, and copying it during transaction start to obtain the value to use for transaction_timestamp. I don't much like the idea of doing a gettimeofday() per SQL statement, especially not if that's taken to mean every SQL statement issued by PL functions (and if it doesn't mean that, "statement_timestamp" seems like the wrong name). One gettimeofday() per client message doesn't seem too horrible though, since that's certainly going to require at least a couple of kernel calls anyway. Possibly we should call it "command_timestamp" not "statement_timestamp" to help reduce confusion. The patch as given strikes me as pretty broken --- it does not advance statement_timestamp when I would expect (AFAICS it only sets it during transaction start). I don't like it stylistically either: ISTM either these things are the responsibility of xact.c or they are the responsibility of postgres.c, it is not sensible to have both modules assigning to statement_timestamp. BTW, now that I look at it, the "statement_timeout" GUC variable seems to have much of the same confusion about whether "statement" is equivalent to "interactive command" or not. regards, tom lane