Re: Partial vacuum versus pg_class.reltuples

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Partial vacuum versus pg_class.reltuples
Date: 2009-06-16 11:18:47
Message-ID: 4A377F97.9070704@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

(back from vacation)

Tom Lane wrote:
> I wrote:
>> Another interesting question is why successive vacuums aren't causing
>> the index reltuples counts to go to zero. Shouldn't a partial vacuum
>> result in *all* pages of the relation being marked as not needing to
>> be examined by the next vacuum?
>
> I figured out the reason for that: the first 32 pages of the table are
> always scanned, even if the whole thing is frozen, because of the
> SKIP_PAGES_THRESHOLD logic. We could change that behavior by
> initializing all_visible_streak to SKIP_PAGES_THRESHOLD instead of zero.
> But if we did so then having even just page zero be skippable would mean
> that we clear scanned_all and thus fail to update reltuples, which is
> probably not a good thing.

Right, that's exactly why I wrote it like that. I also thought about
scanning the (beginning of the) visibility map first to see if there's
big enough gaps in there to warrant skipping pages, but went with the
current approach because it's so much simpler.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2009-06-16 11:19:18 Re: machine-readable explain output
Previous Message Stephen Frost 2009-06-16 10:30:50 Re: [PATCH] backend: compare word-at-a-time in bcTruelen