Re: strange row number estimates in pg9.1rc1 - Mailing list pgsql-hackers

From Sergey E. Koposov
Subject Re: strange row number estimates in pg9.1rc1
Date
Msg-id alpine.LRH.2.00.1108302021220.21041@lnfm1.sai.msu.ru
Whole thread Raw
In response to Re: strange row number estimates in pg9.1rc1  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: strange row number estimates in pg9.1rc1
List pgsql-hackers
On Tue, 30 Aug 2011, Tom Lane wrote:

> Sure enough, that's the problem.  pg_upgrade leaves relpages/reltuples
> set to zero, but it also imports the visibility map pages from the old
> cluster.  If the old visibility map shows the table as all-visible,
> then this happens when you try to VACUUM ANALYZE the table:
>
> 1. VACUUM doesn't process any pages, so it has no tuple density
> estimate.  It leaves reltuples set to zero, but it does set relpages.
>
> 2. ANALYZE scans some part of the table.  It gets a tuple density
> estimate for those pages ... but if that's only a small fraction of
> the table, it believes the zero estimate of tuple density elsewhere.
> So you get only a small update of reltuples.

Thanks for figuring this out.
I wonder what should be the best way to proceed for already migrated 
databases -- running analyze repeatedly may not be the best way for 
very large clusters with large tables...
    S

*******************************************************************
Sergey E. Koposov, PhD
Institute for Astronomy, Cambridge/Sternberg Astronomical Institute
Web: http://lnfm1.sai.msu.ru/~math
E-mail: math@sai.msu.ru


pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: compile from git repository
Next
From: Tom Lane
Date:
Subject: Re: strange row number estimates in pg9.1rc1