----- Original Message ----- 
From: "Tom Lane" <tgl@sss.pgh.pa.us>

> How much later?  clog is not kept forever.

I took a deeper look into the source. Forget my last posting.

As far as I understand your code there is only one chance that information
in clog gets lost:
If XIDs are reused then ExtendCLOG will overwrite existing entries.
Also, it seems to me that VACCUM has not effect on the clog.

Now let's assume that there is a GET_XID_STATUS(xid) function.

If at the time "GET_XID_STATUS(xid)" gets executed 'xid' has not been reused
(which only should occur after about 4 billion transactions following xid),
then the mechanism should work.

If one uses "TransactionIdPrecedes" to check if xid is in the past (as in my
sample code), then the window is restricted to 2 billion transactions, which
seems enough for me. I implemented this check so that the clog lookup code
does not try to fetch pages that do not yet exist (which crashes the
backend) if one supplies a wrong xid.

What do you think?

Thanks, Christian


Fri, 20 Jun 2003 14:32:26 +0200
"Christian Plattner" <postgresql@sioux.ch>
Re: Access to transaction status 
"Christian Plattner" <postgresql@sioux.ch> writes:
> From: "Tom Lane" <tgl@sss.pgh.pa.us>
>> How much later?  clog is not kept forever.

> As far as I understand your code there is only one chance that information
> in clog gets lost:
> If XIDs are reused then ExtendCLOG will overwrite existing entries.
> Also, it seems to me that VACCUM has not effect on the clog.

You're quite mistaken.  clog is truncated during vacuum, once we are
confident that there are no unvacuumed rows in the database with XIDs
older than a certain point.  This is to keep clog space requirements
within reason.

			regards, tom lane

Fri, 20 Jun 2003 10:04:18 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: Access to transaction status 