3 ms·
> - Full vacuum does not touch XIDs - use freeze or just normal vacuum, Don't think that's right. copy_heap_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OID
by anarazel 10y ago
> - Full vacuum does not touch XIDs - use freeze or just normal vacuum,
Don't think that's right.
copy_heap_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex, bool verbose,
bool *pSwapToastByContent, TransactionId *pFreezeXid,
MultiXactId *pCutoffMulti)
...
/*
* Compute xids used to freeze and weed out dead tuples and multixacts.
* Since we're going to rewrite the whole table anyway, there's no reason
* not to be aggressive about this.
*/
vacuum_set_xid_limits(OldHeap, 0, 0, 0, 0,
&OldestXmin, &FreezeXid, NULL, &MultiXactCutoff,
NULL);
/*
* FreezeXid will become the table's new relfrozenxid, and that mustn't go
* backwards, so take the max.
*/
if (TransactionIdPrecedes(FreezeXid, OldHeap->rd_rel->relfrozenxid))
FreezeXid = OldHeap->rd_rel->relfrozenxid;
i.e. the cutoff is computed in copy_heap_data(). And then in
void
rewrite_heap_tuple(RewriteState state,
HeapTuple old_tuple, HeapTuple new_tuple)
{
...
/*
* While we have our hands on the tuple, we may as well freeze any
* eligible xmin or xmax, so that future VACUUM effort can be saved.
*/
heap_freeze_tuple(new_tuple->t_data, state->rs_freeze_xid,
state->rs_cutoff_multi);
- limaoscarjuliet 10y agoI'm speaking from experience with 9.1, I perhaps this has changed since (5+ years of dev!). I ran an experiment to demonstrate no XID reset on vacuum full: I ran a test: XID age in callback 354015 (0% of max) task=# vacuum full callback; XID age in callback 354015 (0% of max) task=# vacuum freeze callback; XID age in callback 11 (0% of max)
- anarazel 10y agoYea, but that's not the same as not freezing at all - it freezes stuff older than autovacuum_freeze_min_age.