Mark Rostron <mrostron@xxxxxxx> writes: >> No. XID comparisons are modulo 2^31. > Thanks - I'm still trying to wrap my mind around this (sorry). > So, for the sake of this description: > - the XID space (size 2^32) is split into two sub-spaces, each of size 2^31 No, it is not. The XID space is continuous and circular. For any given XID, there are 2^31-1 possible XIDs that are "before" it and 2^31-1 that are "after" it (plus the special FrozenXID value, which is always before everything else). There's no absolute comparisons possible, only relative ones. Everything works without wraparound hiccups, because the XID space has no endpoints. The price is that consistency is lost if there are ever XIDs in the system that are more than 2^31 transactions apart. We avoid that by replacing old XIDs with FrozenXID before they get to be more than 2^31 transactions old. > Therefore, a query can only see rows where: > (q.o > r.o) && (q.s == r.s) || (q.o <= r.o) && (q.s != r.s) Actually, to compare two XIDs we just do a signed subtraction (ignoring overflow) and see if the result is positive or negative. regards, tom lane -- Sent via pgsql-admin mailing list (pgsql-admin@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin