Re: txid and current_timestamp

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: txid and current_timestamp
Date: 2012-06-26 13:19:55
Message-ID: 4508.1340716795@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jasen Betts <jasen(at)xnet(dot)co(dot)nz> writes:
> On 2012-06-26, Vlad Arkhipov <arhipov(at)dc(dot)baikal(dot)ru> wrote:
>> Is it guaranteed that if txid2 > txid1 then current_timestamp in
>> transaction 2 >= current_timestamp in transaction 1?

> no.

To enlarge on that: current_timestamp is set at the moment of receipt
from the client of a transaction's first command. XID is not set until
(and unless) the transaction does something that modifies the database.
The elapsed time between can be quite variable depending on what
commands the client issues.

Even if this weren't the case, I wouldn't recommend relying on such an
assumption, because of factors like clock skew between different
processors.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Albe Laurenz 2012-06-26 13:21:37 Re: dblink causing import errors
Previous Message Stuart Bishop 2012-06-26 12:18:57 Re: Minimal streaming replication