Received: from eta.ece.rice.edu (ece.rice.edu [128.42.4.34]) by hub.org (8.9.2/8.9.1) with ESMTP id NAA80337 for ; Tue, 9 Mar 1999 13:56:07 -0500 (EST) (envelope-from reedstrm@rice.edu) Received: from rice.edu (wallace.ece.rice.edu [128.42.12.154]) by eta.ece.rice.edu (8.9.0/8.9.0) with ESMTP id MAA12808 for ; Tue, 9 Mar 1999 12:51:29 -0600 (CST) Sender: reedstrm@ece.rice.edu Message-ID: <36E56EC4.F9AD68E8@rice.edu> Date: Tue, 09 Mar 1999 12:56:04 -0600 From: "Ross J. Reedstrom" Organization: NSBRI X-Mailer: Mozilla 4.06 [en] (X11; U; Linux 2.0.34 i686) MIME-Version: 1.0 To: PG-SQL Subject: Re: [SQL] How to optimize a query... References: <36E56930.7F57299D@kearneydev.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit secret wrote: 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., NSBRI Research Scientist/Programmer Computer and Information Technology Institute Rice University, 6100 S. Main St., Houston, TX 77005