Re: start of transaction (was: Re: [PERFORM] Help with - Mailing list pgsql-hackers

From Dennis Bjorklund
Subject Re: start of transaction (was: Re: [PERFORM] Help with
Date
Msg-id Pine.LNX.4.44.0311161645350.26313-100000@zigo.dhs.org
Whole thread Raw
In response to Re: start of transaction (was: Re: [PERFORM] Help with count(*))  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Sun, 16 Nov 2003, Tom Lane wrote:

> There isn't any compelling implementation reason when to freeze the
> value of now().  Reasonable options are
>     1. at BEGIN (current behavior)
>     2. at transaction's external creation 
>     3. at freezing of transaction snapshot
> #1 and #2 are actually the same at the moment, but could be decoupled
> as sketched above, in which case the behavior of #2 would effectively
> become "at first command afte BEGIN".
> 
> I argued that now() should be frozen at the time of the transaction
> snapshot, and I still think that that's a defensible behavior.

Is it important exactly what value is returned as long as it's the same in 
the whole transaction? I think not.

To me it would be just as logical to fix it at the first call to now() in
the transaction. The first time you call it you get the actual time as it
is now and the next time you get the same as before since every operation
in the transaction logically happens at the same time. If you don't call
now() at all, the system time will not be fetched at all.

-- 
/Dennis



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: start of transaction (was: Re: [PERFORM] Help with count(*))
Next
From: Jan Wieck
Date:
Subject: Re: cvs head? initdb?