pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Neil Conway <neilc@samurai.com>
Cc: Bruce Momjian <pgman@candle.pha.pa.us>
Cc: Brendan Jurd <direvus@gmail.com>
Cc: pgsql-patches@postgresql.org
Subject: Re: Additional current timestamp values
Date: Mon, 20 Mar 2006 18:38:45 -0500
Message-ID: <9025.1142897925@sss.pgh.pa.us> (raw)
In-Reply-To: <441F351E.8030203@samurai.com>
References: <200603202234.k2KMYOM04077@candle.pha.pa.us>
	<441F351E.8030203@samurai.com>

Neil Conway <neilc@samurai.com> 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



view thread (21+ messages)  latest in thread

Message-ID: <9025.1142897925@sss.pgh.pa.us>
Permalink:  ../9025.1142897925@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/9025.1142897925@sss.pgh.pa.us

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, neilc@samurai.com, pgman@candle.pha.pa.us, direvus@gmail.com, pgsql-patches@postgresql.org
  Subject: Re: Additional current timestamp values
  In-Reply-To: <9025.1142897925@sss.pgh.pa.us>
  References: <200603202234.k2KMYOM04077@candle.pha.pa.us> <441F351E.8030203@samurai.com> <9025.1142897925@sss.pgh.pa.us>

* 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