Re: Optimizing

From: "Josh Berkus" <josh(at)agliodbs(dot)com>
To: "Jeff Sack" <sackj(at)alum(dot)rpi(dot)edu>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Optimizing
Date: 2001-11-09 15:54:05
Message-ID: web-502469@davinci.ethosmedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Jeff,

> Hello all. I have an academic project that I'm working on and, as
> I'm
> relatively new to optimization techniques and database design, I'm
> wondering if some of you can give me some pointers.

See the PostgreSQL book review page:
http:\\techdocs.postgresql.org\bookreviews.php
There, you will find reviews of several good books on database design.

> There are several interesting queries that I've been constructing
> just
> to get a feel for this schema, and given that some of these tables
> contain 100,000-200,000 tuples, some queries are taking a good 5-10
> seconds to execute. I'm just wondering if this is simply the fault
> of
> my schema or are these queries poorly constructed?

That entirely depends. If you're doing this on a 3-year-old laptop,
5-10 seconds is a *good* time. But not on a Proliant 9000.

Here's the rules of indexing:
1. All JOIN columns should be indexed.
2. All criteria (WHERE) columns should be indexed, except
those that have a very limited range of values (e.g. BOOLEAN).
3. All ORDER BY columns should be indexed, with the same exception.
4. Multi-column indexes are seldom useful for queries.
5. VACUUM should be performed regularly.
6. If SELECT is very fast and INSERT is very slow, try removing a few
indexes.

Also, you can muck around with runtime settings to you heart's content,
and moving the log files (pgsql/data/xlog) to a seperate drive improves
performance. There are no quick answers once you've taken the basic
steps.

-Josh

______AGLIO DATABASE SOLUTIONS___________________________
Josh Berkus
Complete information technology josh(at)agliodbs(dot)com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco

In response to

  • Optimizing at 2001-11-08 21:54:59 from Jeff Sack

Browse pgsql-sql by date

  From Date Subject
Next Message Stephan Szabo 2001-11-09 15:57:41 Re: Optimization, etc
Previous Message Tille, Andreas 2001-11-09 14:46:26 Re: Design Tool for postgresql