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