Re: Visibility map, partial vacuums - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Visibility map, partial vacuums
Date
Msg-id 18086.1227537479@sss.pgh.pa.us
Whole thread Raw
In response to Re: Visibility map, partial vacuums  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Responses Re: Visibility map, partial vacuums
Re: Visibility map, partial vacuums
List pgsql-hackers
Heikki Linnakangas <heikki.linnakangas@enterprisedb.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
toset the bit, fetch the corresponding map page  (I/O might happen here)* get share lock on heap page, then recheck its
headerbit;  if still set, set the map bit
 
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Merlin Moncure"
Date:
Subject: Re: blatantly a bug in the documentation
Next
From: Peter Eisentraut
Date:
Subject: Re: [COMMITTERS] pgsql: Add support for matching wildcard server certificates to the new