Re: visibility map and reltuples

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: Greg Stark <greg(dot)stark(at)enterprisedb(dot)com>, "Ned T(dot) Crigler" <crigler(at)users(dot)sourceforge(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: visibility map and reltuples
Date: 2008-12-15 15:55:50
Message-ID: 1223.1229356550@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:
> Greg Stark wrote:
>> I wonder if we should switch to keeping reltuplesperpage instead. Then a
>> partial vacuum could update it by taking the average number of tuples
>> per page forbthe pages it saw. Perhaps adjusting it to the weights
>> average between the old value and the new value based on how many pages
>> were seen.

> The pages scanned by a partial vacuum isn't a random sample of pages in
> the table. That would bias the reltuplesperpage value towards those
> pages that are updated more.

Yeah ... and it's highly likely that repeatedly-updated pages would have
more dead space than never-updated ones, so there'd be a systematic
creep towards underestimation of the total tuple count.

I think your previous sketch is right: suppress update of reltuples (and
relpages) from a partial vacuum scan, and ensure that the analyze phase
is allowed to do it instead if it happens during VACUUM ANALYZE.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2008-12-15 16:01:48 Re: rules regression test failed on mingw
Previous Message Michael Meskes 2008-12-15 15:43:47 Re: Looking for someone with MinGW