Re: Quick idea for reducing VACUUM contention - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Quick idea for reducing VACUUM contention
Date
Msg-id 20070731030030.GZ7628@alvh.no-ip.org
Whole thread Raw
In response to Re: Quick idea for reducing VACUUM contention  (ITAGAKI Takahiro <itagaki.takahiro@oss.ntt.co.jp>)
Responses Re: Quick idea for reducing VACUUM contention  (Decibel! <decibel@decibel.org>)
List pgsql-hackers
ITAGAKI Takahiro wrote:
> 
> Alvaro Herrera <alvherre@commandprompt.com> wrote:
> 
> > > I think we might need additional "freezing-xmax" operations to avoid
> > > XID-wraparound in the first path of vacuum, though it hardly occurs.
> > 
> > I'm not sure I follow.  Can you elaborate?  Do you mean storing a
> > separate relfrozenxmax for each table or something like that?
> 
> We need to work around wraparound of xmax in dead tuples. If we miss to
> vacuum them and XID is wrapped, we cannot remove them until the next
> XID-wraparound, because we treat them to be deleted in the *future*.

Oh, but this should not be a problem, because a tuple is either frozen
or removed completely -- xmax cannot precede xmin.


> > > We just add XID of the vacuum to dead tuples we see in the
> > > first path. When backends find a dead tuple and see the transaction
> > > identified by XID in it has commited, they can freely reuse the area of
> > > the dead tuple because we can assume index entries pointing the tuple
> > > have been removed by the vacuum.
> > 
> > I would be worried about leftover index entries being later used by new
> > tuples in the heap.  Then when you visit the index, find that entry, go
> > to the heap and find the new tuple and return it, which could be bogus.
> 
> Avoiding dangling index entries, I'm thinking about reusing dead tuples
> only if we see the VACUUM transaction have committed successfully.
> That means the VACUUM transaction removed all index entries corresponding
> those dead tuples; They are now Heap-Only-Tuples, so that we can recycle
> them in the same manner as HOT updated tuples.

Hmm.  OK, I admit I have no idea how HOT works.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: default_text_search_config and expression indexes
Next
From: Alvaro Herrera
Date:
Subject: Re: Reducing stats collection overhead