Frequency of Analyze?

From: Benjamin Smith <lists(at)benjamindsmith(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Frequency of Analyze?
Date: 2005-10-28 20:47:49
Message-ID: 200510281347.49332.lists@benjamindsmith.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have a rapidly growing database with a very complex schema, and I'm looking
to improve performance. It's typical to have 2-4 foreign keys in each table,
and there are currently 113 tables, and queries with 5-10 tables with
combined inner/outer joins are pretty typical. (I avoid subqueries anywhere I
can)

So far, my guiding philosophy has been "constrain everything" with primary
keys, unique, foreign keys and the like, relying on the implicit indexes and
the query scheduler to handle things, and so far, it's worked very well.

The database has grown in total size (calculated by the size of a pg_dump) 25%
in the past month, and the growth rate seems to be accellerating. (yikes!) We
are buying new equipment now, but I'd still like to optimize as best as
possible.

A few questions:

1) Any problem with running "Analyze" hourly via cron?

2) Does "Vacuum analyze" also do the actions performed by "Analyze"?

3) What's the best way to handle indexes when only 1 index is used per table
in a query, but there are several due to the various constraints on it? Is
there a way to benefit from all of these other indexes somehow? Is there a
definitive, detailed book for optimizing PG queries?

-Ben

--
"The best way to predict the future is to invent it."
- XEROX PARC slogan, circa 1978

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Douglas McNaught 2005-10-28 21:04:11 Re: Function written in C, hangs on one machine and not another...
Previous Message CG 2005-10-28 20:17:01 Re: Function written in C, hangs on one machine and not another...