On 05/23/2013 10:03 PM, Andres Freund wrote: > On 2013-05-23 19:51:48 +0200, Andres Freund wrote: >> We currently need to make sure we scanned the whole relation and have >> frozen everything to have a sensible relfrozenxid for a relation. >> >> So, what I propose instead is basically: >> 1) only vacuum non-all-visible pages, even when doing it for >> anti-wraparound >> 2) When we can set all-visible guarantee that all tuples on the page are >> fully hinted. During recovery do the same, so we don't need to log >> all hint bits. >> We can do this with only an exclusive lock on the buffer, we don't >> need a cleanup lock. >> 3) When we cannot mark a page all-visible or we cannot get the cleanup >> lock, remember the oldest xmin on that page. We could set all visible >> in the former case, but we want the page to be cleaned up sometime >> soonish. >> 4) If we can get the cleanup lock, purge dead tuples from the page and >> the indexes, just as today. Set the page as all-visible. >> >> That way we know that any page that is all-visible doesn't ever need to >> look at xmin/xmax since we are sure to have set all relevant hint >> bits. > Heikki noticed that I made quite the omission here which is that you > would need to mark tuples as all visible as well. I was thinking about > using HEAP_MOVED_OFF | HEAP_MOVED_IN as a hint for that. We could have a "vacuum_less=true" mode, where instead of marking tuples all visible here you actually freeze them, that is set the xid to frozen. You will get less forensic capability in exchange of less vacuuming.
Maybe also add an "early_freeze" hint bit to mark this situation. Or maybe set the tuples frozenxid when un-marking the page as all visible to delay the effects a little ? Hannu > > Greetings, > > Andres Freund > -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers