Re: Getting rid of extra gettimeofday() calls

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Getting rid of extra gettimeofday() calls
Date: 2006-06-19 20:27:58
Message-ID: 21318.1150748878@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Simon Riggs <simon(at)2ndquadrant(dot)com> writes:
> Presumably you don't mean *every* client message, just stmt start ones.

At the moment I've got it setting the statement_timestamp on receipt of
any message that could lead to execution of user-defined code; that
includes Query, Parse, Bind, Execute, FunctionCall. Possibly we could
dispense with the Bind one but I'm unconvinced.

> Can we set that in GetTransactionSnapshot() - that way a serializable
> transaction won't need to update the time after each statement.

No, that's much too late, unless you want to do major rearrangement of
the times at which reporting actions occur. Furthermore the entire
point of statement_timestamp is that it advances for new commands within
the same xact, so your proposal amounts to removing statement_timestamp
entirely.

The actual behavior of CVS tip is that transaction_timestamp copies from
statement_timestamp, not vice versa; that seems fine to me.

> Presumably we have to do at least one at the end when doing statement
> logging?

Only if you've got log_duration on. Per Jim's suggestion, maybe we
could have the <IDLE> activity report advance activity_timestamp only
if log_duration is true, ie, only if it's free to do so.

> I notice there is also one in elog.c for when we have %t set. We
> probably don't need to do both when statement logging.

I'm inclined to think that that one is worth its keep. Sometimes you
really wanna know exactly when a log message was emitted ...

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-06-19 20:40:26 Re: Generic Monitoring Framework Proposal
Previous Message Simon Riggs 2006-06-19 20:13:28 Re: Getting rid of extra gettimeofday() calls