Re: getting rid of freezing

From: Hannu Krosing <hannu(at)krosing(dot)net>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: getting rid of freezing
Date: 2013-05-24 03:49:37
Message-ID: 519EE351.3090408@krosing.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Christoph Berg 2013-05-24 05:16:38 Re: PostgreSQL 9.3 beta breaks some extensions "make install"
Previous Message Fabrízio de Royes Mello 2013-05-24 03:39:56 Re: Patch to .gitignore