X-Original-To: pgsql-admin@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 98612475E91 for ; Fri, 18 Apr 2003 16:05:25 -0400 (EDT) Received: from wolff.to (wolff.to [66.93.249.74]) by postgresql.org (Postfix) with SMTP id D1234475458 for ; Fri, 18 Apr 2003 16:05:24 -0400 (EDT) Received: (qmail 17711 invoked by uid 500); 18 Apr 2003 20:05:51 -0000 Date: Fri, 18 Apr 2003 15:05:51 -0500 From: Bruno Wolff III To: Derek Hamilton Cc: Marc Mitchell , pgsql-admin@postgresql.org Subject: Re: Performance Expectations Message-ID: <20030418200551.GA17645@wolff.to> Mail-Followup-To: Derek Hamilton , Marc Mitchell , pgsql-admin@postgresql.org References: <000501c305d7$b001a070$1b01a8c0@jcaves.net> <006c01c305db$28050460$6701050a@eisolution.com> <000401c305e4$7aaa2840$1b01a8c0@jcaves.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <000401c305e4$7aaa2840$1b01a8c0@jcaves.net> User-Agent: Mutt/1.5.4i X-Spam-Status: No, hits=-38.0 required=5.0 tests=BAYES_10,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, REFERENCES,REPLY_WITH_QUOTES,USER_AGENT_MUTT autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200304/263 X-Sequence-Number: 8418 On Fri, Apr 18, 2003 at 12:55:35 -0700, Derek Hamilton wrote: > Hey Marc, > > I've run the EXPLAIN statement on the query and it does use the index. > > I also use an "order by" on the table that does not include the indexed > field. Would adding an index for the fields I'm ordering by help at all? Maybe. If the search returns only a small portion of the records in the table it is probably more efficient to use the current index for searching and then do a sort on the returned records rather than scan the table in the output order selecting records that match the search criteria. Also extra indexes will slow down inserts and updates so if you are doing a lot of those, you need to balance that against your select performance.