From: | "Ross J(dot) Reedstrom" <reedstrm(at)rice(dot)edu> |
---|---|
To: | PG-SQL <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: [SQL] How to optimize a query... |
Date: | 1999-03-09 18:56:04 |
Message-ID: | 36E56EC4.F9AD68E8@rice.edu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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(at)rice(dot)edu>
NSBRI Research Scientist/Programmer
Computer and Information Technology Institute
Rice University, 6100 S. Main St., Houston, TX 77005
From | Date | Subject | |
---|---|---|---|
Next Message | Tim Perdue | 1999-03-10 01:33:02 | Performance |
Previous Message | Fernezelyi Marton | 1999-03-09 18:39:12 | help |