On Thu, Dec 6, 2012 at 1:01 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> I think taking a second whack at setting the visibility bit is a fine
> idea, but let's drop all the rest of this premature optimization.
If there's any optimization needed here, we should try to do it by
remembering relevant details from the first vacuum pass in
backend-private memory, rather than by changing the on-disk format.
One other thought: I'm wondering if we shouldn't try to push the work
of setting the all-visible bit into heap_page_prune(). That would
allow HOT pruning to set the bit. For example, consider an
all-visible page. A tuple is HOT-updated and the page becomes
not-all-visible. Now the page is pruned, removing the old tuple and
changing the line pointer to a redirect. Presto, page is all-visible
Also, it seems to me that heap_page_prune() is already figuring out
most of the stuff we need to know in order to decide whether to set
PD_ALL_VISIBLE. The logic looks quite different from what is
happening in the vacuum code, because the vacuum code iterates over
all of the line pointers while the pruning code is walking HOT chains.
But it seems to me that a page can't be all-visible unless there are
no dead line pointers and no HOT chains of length != 1, and
heap_prune_chain() does manage to call HeapTupleSatisfiesVacuum() for
every tuple, so the raw information seems like it is available without
any additional CLOG lookups.
The Enterprise PostgreSQL Company
In response to
pgsql-hackers by date
|Next:||From: Tom Lane||Date: 2012-12-06 18:36:47|
|Subject: Re: why can't plpgsql return a row-expression?|
|Previous:||From: Jan Wieck||Date: 2012-12-06 18:34:08|
|Subject: Re: autovacuum truncate exclusive lock round two|