Re: visibility map and reltuples

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: "Ned T(dot) Crigler" <crigler(at)users(dot)sourceforge(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: visibility map and reltuples
Date: 2008-12-14 11:15:16
Message-ID: 4944EAC4.4070002@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Ned T. Crigler wrote:
> It appears that the visibility map patch is causing pg_class.reltuples to be
> set improperly after a vacuum. For example, it is set to 0 if the map
> indicated that no pages in the heap needed to be scanned.
>
> Perhaps reltuples should not be updated unless every page was scanned during
> the vacuum?

Yeah, vacuum shouldn't overwrite reltuples if it hasn't scanned all pages.

The interplay of vacuum and analyze in VACUUM ANALYZE needs to be
changed too. Currently, the analyze after vacuum doesn't overwrite
reltuples, because the one calculated by vacuum is based on scanning all
pages, and is thus more accurate than the one estimated from the sample
(which is not true anymore, as you pointed out). I think the vacuum
needs to somehow tell analyze whether it updated reltuples or not, so
that analyze can update reltuples if the vacuum didn't scan all pages.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Meskes 2008-12-14 12:17:08 Re: Looking for someone with MinGW
Previous Message Jan Urbański 2008-12-14 10:58:53 Re: Stats target increase vs compute_tsvector_stats()