Re: Visibility map, partial vacuums

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Visibility map, partial vacuums
Date: 2008-11-24 14:37:59
Message-ID: 18086.1227537479@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com> writes:
> I've been thinking that we could add one frozenxid field to each
> visibility map page, for the oldest xid on the heap pages covered by the
> visibility map page. That would allow more fine-grained anti-wraparound
> vacuums as well.

This doesn't strike me as a particularly good idea. Right now the map
is only hints as far as vacuum is concerned --- if you do the above then
the map becomes critical data. And I don't really think you'll buy
much.

> The visibility map won't be inquired unless you vacuum. This is a bit
> tricky. In vacuum, we only know whether we can set a bit or not, after
> we've acquired a cleanup lock on the page, and scanned all the tuples.
> While we're holding a cleanup lock, we don't want to do I/O, which could
> potentially block out other processes for a long time. So it's too late
> to extend the visibility map at that point.

This is no good; I think you've made the wrong tradeoffs. In
particular, even though only vacuum *currently* uses the map, you want
to extend it to be used by indexscans. So it's going to uselessly
spring into being even without vacuums.

I'm not convinced that I/O while holding cleanup lock is so bad that we
should break other aspects of the system to avoid it. However, if you
want to stick to that, how about
* vacuum page, possibly set its header bit
* release page lock (but not pin)
* if we need to set the bit, fetch the corresponding map page
(I/O might happen here)
* get share lock on heap page, then recheck its header bit;
if still set, set the map bit

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2008-11-24 14:40:00 Re: [COMMITTERS] pgsql: Add support for matching wildcard server certificates to the new
Previous Message Merlin Moncure 2008-11-24 14:37:49 Re: blatantly a bug in the documentation