pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: Jeff Sack <sackj@alum.rpi.edu>
To: pgsql-sql@postgresql.org
Subject: Re: Optimizing
Date: Fri, 09 Nov 2001 07:54:05 -0800
Message-ID: <web-502469@davinci.ethosmedia.com> (raw)
In-Reply-To: <003301c168a0$034d53e0$019ca8c0@jeff>

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@agliodbs.com
   and data management solutions       (415) 565-7293
  for law firms, small businesses        fax 621-2533
    and non-profit organizations.      San Francisco



view thread (6+ messages)  latest in thread

Message-ID: <web-502469@davinci.ethosmedia.com>
Permalink:  ../web-502469@davinci.ethosmedia.com/
Also on:    postgresql.org/message-id/web-502469@davinci.ethosmedia.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: josh@agliodbs.com, sackj@alum.rpi.edu
  Subject: Re: Optimizing
  In-Reply-To: <web-502469@davinci.ethosmedia.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox