Just to further this a bit -- running or not running VACUUM ANALYZE can
have huge
performance implications. Some queries were taking extremely long times
to execute on our database. Running a VACUUM ANALYZE (which had not
ever been done on this database, despite having inserted hundreds of
thousands of records) led to at least an order of magnitude improvement
in the performance of the query. Basically, the optimizer was working
with no good information before the VACUUM ANALYZE; now it's got all
kinds of statistics to improve its optimization.
This particular query was joining about 5 tables, so there were lots
of opportunities for optimization.
Jason Priebe
Mi-Co
http://www.mi-corporation.com/
> -----Original Message-----
> From: pgsql-general-owner@postgresql.org
> [mailto:pgsql-general-owner@postgresql.org] On Behalf Of Tim Barnard
>
> Vacuum analyze updates the statistics that the db uses to
> determine various
> query plans, so I'd always run it as vacuum analyze, rather than just
> vacuum.
>
> ----- Original Message -----
> From: "Peter Peltonen" <peter.peltonen@fivetec.com>
>
> > Is vacuum --analyze for just providing information or does
> it somehow
> > store it's info for postgresql's use (in other words:
> should I run it too,
> > and if so, should I do it before or after the real vacuum?).
> >