Re: [DOCS] Autovacuum and XID wraparound

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: "Jim C(dot) Nasby" <decibel(at)decibel(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Chris Browne <cbbrowne(at)acm(dot)org>, pgsql-patches(at)postgresql(dot)org, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Subject: Re: [DOCS] Autovacuum and XID wraparound
Date: 2007-05-16 02:02:18
Message-ID: 20070516020218.GX12731@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs pgsql-patches

Jim C. Nasby wrote:
> On Tue, May 15, 2007 at 06:13:47PM -0400, Alvaro Herrera wrote:
> > Tom Lane wrote:
> > > Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> > > > I suppose it would be pretty trivial to set the relfrozenxid to
> > > > RecentXmin or something during TRUNCATE.
> > >
> > > I had the idea we were doing that already --- at least I'm pretty sure I
> > > remember it being discussed. But I see it's not being done in HEAD.
> >
> > Patch to do it attached. I am thinking we can do something similar in
> > CLUSTER as well.
>
> Actually, it already happens for CLUSTER because cluster calls
> heap_create_with_catalog, which calls AddNewRelationTuple. See
> backend/catalog/heap.c line 716.

Right, but that heap is dropped later, and only the relfilenode remains,
because they are swapped.

In any case the change is a very small patch, which I attach but I
haven't tested. This only works if the new rewriteheap stuff actually
changes Xids to follow OldestXmin, i.e. all tuples that have older
Xmin/Xmax are frozen (or marked with the current Xid). Heikki, can you
confirm that this is the case?

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

Attachment Content-Type Size
cluster-relfrozenxid.patch text/x-diff 2.9 KB

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Tom Lane 2007-05-16 05:20:56 Re: [DOCS] Autovacuum and XID wraparound
Previous Message Jim C. Nasby 2007-05-16 00:29:36 Re: [PATCHES] OS/X startup scripts

Browse pgsql-patches by date

  From Date Subject
Next Message Greg Smith 2007-05-16 03:02:44 Re: [PATCHES] Automatic adjustment of bgwriter_lru_maxpages
Previous Message Bruce Momjian 2007-05-16 01:46:34 Re: [PATCHES] Reviewers Guide to Deferred Transactions/TransactionGuarantee