Re: visibility map and reltuples - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: visibility map and reltuples
Date
Msg-id 4944EAC4.4070002@enterprisedb.com
Whole thread Raw
In response to visibility map and reltuples  ("Ned T. Crigler" <crigler@users.sourceforge.net>)
Responses Re: visibility map and reltuples  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
List 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


pgsql-hackers by date:

Previous
From: Jan Urbański
Date:
Subject: Re: Stats target increase vs compute_tsvector_stats()
Next
From: Michael Meskes
Date:
Subject: Re: Looking for someone with MinGW