Re: XID comparations

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: carlosreimer(at)terra(dot)com(dot)br
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: XID comparations
Date: 2006-06-13 15:40:06
Message-ID: 23805.1150213206@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Carlos H. Reimer" <carlosreimer(at)terra(dot)com(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2006-06-13 15:47:14 Re: XID comparations
Previous Message gl 2006-06-13 15:35:27 Re: pg_dump: missing pg_database entry