09.01.2014 05:15, Peter Eisentraut kirjoitti:
pg_upgrade creates a script analyze_new_cluster.{sh|bat} that runs vacuumdb --analyze-only in three stages with different statistics target settings to get a fresh cluster analyzed faster. I think this behavior is also useful for clusters or databases freshly created by pg_restore or any other loading mechanism, so it's suboptimal to have this constrained to pg_upgrade.
I think the three stage analyze is a wrong solution to the "slow analyze" problem. In my experience most of the analyze time goes to reading random blocks from the disk but we usually use only a small portion of that data (1 row per block.)
If we were able to better utilize the data we read we could get good statistics with a lot less IO than we currently need. This was discussed in length at http://www.postgresql.org/message-id/CAM-w4HOjRbNPMW=shjhw_qfapcuu5ege1tmdr0zqu+kqx8q...@mail.gmail.com but it hasn't turned into patches so far.
/ Oskari -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers