Re: Order of Daily VACUUM, CLUSTER, REINDEX

From: Leonardo F <m_lists(at)yahoo(dot)it>
To: APseudoUtopia <apseudoutopia(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Order of Daily VACUUM, CLUSTER, REINDEX
Date: 2010-03-19 16:18:05
Message-ID: 896754.76254.qm@web29018.mail.ird.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> VACUUM ANALYZE;
> CLUSTER;
> REINDEX DATABASE "database";

ANALYZE has to go after CLUSTER; and CLUSTER already
vacuums the tables (I'm not 100% sure though). CLUSTER also
reindexes the whole table, so there's no need for another REINDEX.

I think the right way of doing it would be:

CLUSTER;
ANALYZE; (no "vacuum analyze", just "analyze").

Beware though that CLUSTER and REINDEX can be very long processes,
and that CLUSTER locks the whole table... they're not tools supposed to
be used that often (since there's usually no need to run them so often).

Why do you think you need to run those commands daily?

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jay 2010-03-19 16:33:57 Help me with this tricky join
Previous Message Robert Treat 2010-03-19 16:11:00 Postgres officially accepted in to 2010 Google Summer of Code program