Re: XID comparations - Mailing list pgsql-general

From Tom Lane
Subject Re: XID comparations
Date
Msg-id 23805.1150213206@sss.pgh.pa.us
Whole thread Raw
In response to XID comparations  ("Carlos H. Reimer" <carlosreimer@terra.com.br>)
List pgsql-general
"Carlos H. Reimer" <carlosreimer@terra.com.br> writes:
> I would like to understand better the logic to determine when a xid is older
> than another one.

It's circular mod 2^32, with a special case for FrozenXID.  It's a
mistake to imagine that XIDs are unsigned ints, really --- the
comparison doesn't work that way.  For an XID of say 1billion, XIDs from
1billion to 3billion are "after", the rest "before".  So once a row
is created, it has to be deleted or frozen within 2 billion
transactions, else its XID wraps around and appears to be "in the
future" rather than "in the past" compared to current XIDs.

            regards, tom lane

pgsql-general by date:

Previous
From: Scott Ribe
Date:
Subject: Re: Fabian Pascal and RDBMS deficiencies in fully
Next
From: Martijn van Oosterhout
Date:
Subject: Re: XID comparations