Frequency of Analyze? - Mailing list pgsql-general

From Benjamin Smith
Subject Frequency of Analyze?
Date
Msg-id 200510281347.49332.lists@benjamindsmith.com
Whole thread Raw
Responses Re: Frequency of Analyze?
List 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

pgsql-general by date:

Previous
From: CG
Date:
Subject: Re: Function written in C, hangs on one machine and not another...
Next
From: David Gama Rodrí­guez
Date:
Subject: tsearch2 setweight