Re: [SQL] [GENERAL] CURRENT_TIMESTAMP

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Andrew Sullivan <andrew(at)libertyrms(dot)info>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [SQL] [GENERAL] CURRENT_TIMESTAMP
Date: 2002-10-04 05:20:55
Message-ID: 17731.1033708855@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers pgsql-sql

Oliver Elphick <olly(at)lfix(dot)co(dot)uk> writes:
> I can see that the current behaviour might give surprising results in a
> long running transaction. Surprise could be reduced by giving the time
> of first use within the transaction rather than the start of the
> transaction.

[ cogitates ... ] Hmm, we could do that, and it probably would break
few if any existing apps. But would it really reduce the surprise
factor? The complaints we've heard so far all seemed to come from
people who expected multiple current_timestamp calls to show advancing
times within a transaction.

Oliver's idea might be worth doing just on performance grounds: instead
of a gettimeofday() call at the start of every transaction, we'd only
have to reset a flag variable. When and if current_timestamp is done
inside the transaction, then call the kernel to ask what time it is.
We win on every transaction that does not contain a current_timestamp
call, which is probably a good bet for most apps. But I don't think
this does much to resolve the behavioral complaints.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Craig Longman 2002-10-04 05:26:36 LC_COLLATE problem between linux distros
Previous Message Oliver Elphick 2002-10-04 05:03:13 Re: [SQL] [GENERAL] CURRENT_TIMESTAMP

Browse pgsql-hackers by date

  From Date Subject
Next Message Curtis Faith 2002-10-04 05:26:36 Re: Advice: Where could I be of help?
Previous Message Oliver Elphick 2002-10-04 05:03:13 Re: [SQL] [GENERAL] CURRENT_TIMESTAMP

Browse pgsql-sql by date

  From Date Subject
Next Message Shridhar Daithankar 2002-10-04 08:00:54 Re: [HACKERS] Large databases, performance
Previous Message Oliver Elphick 2002-10-04 05:03:13 Re: [SQL] [GENERAL] CURRENT_TIMESTAMP