From: Ross J. Reedstrom <reedstrm@rice.edu>
To: PG-SQL <pgsql-sql@postgresql.org>
Subject: Re: [SQL] How to optimize a query...
Date: Tue, 09 Mar 1999 12:56:04 -0600
Message-ID: <36E56EC4.F9AD68E8@rice.edu> (raw)
References: <36E56930.7F57299D@kearneydev.com>
secret wrote:
<description of sloq query, with proper EXPLAIN output... thanks!>
Hmm, it looks like your tables are big enough to benefit from indices,
but the query plan didn't choose any. I'd guess an index on po.po_id,
and perhaps tickets.material_po and tickets.trucking_po might help.
From what I understand, indices are of most use on attributes (fields)
that are mostly unique, like your po_id is (probably). They can hurt you
if you build them on fields that are mostly _not_ unique (the classic
example being a gender field - only two likely values, lost of rows
returned for either, so you scan anyway...)
Any real experts out there to correct me? ;-)
Ross
--
Ross J. Reedstrom, Ph.D., <reedstrm@rice.edu>
NSBRI Research Scientist/Programmer
Computer and Information Technology Institute
Rice University, 6100 S. Main St., Houston, TX 77005
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: reedstrm@rice.edu
Subject: Re: [SQL] How to optimize a query...
In-Reply-To: <36E56EC4.F9AD68E8@rice.edu>
References: <36E56930.7F57299D@kearneydev.com> <36E56EC4.F9AD68E8@rice.edu>
* 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