X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id AEB49D1B973 for ; Thu, 11 Mar 2004 09:02:40 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 73771-02 for ; Thu, 11 Mar 2004 05:02:37 -0400 (AST) Received: from curie.credativ.org (credativ.com [217.160.209.18]) by svr1.postgresql.org (Postfix) with ESMTP id B87AFD1B906 for ; Thu, 11 Mar 2004 05:02:35 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by curie.credativ.org (Postfix) with ESMTP id E4C5155EFA; Thu, 11 Mar 2004 10:02:36 +0100 (CET) Received: from colt.pezone.net (dsl-213-023-254-012.arcor-ip.net [213.23.254.12]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by curie.credativ.org (Postfix) with ESMTP id 92EC155BEB; Thu, 11 Mar 2004 10:02:35 +0100 (CET) From: Peter Eisentraut To: Mark Lubratt , pgsql-admin@postgresql.org Subject: Re: Explain Analyze help Date: Thu, 11 Mar 2004 10:02:31 +0100 User-Agent: KMail/1.5.1 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200403111002.31577.peter_e@gmx.net> X-Virus-Scanned: by AMaViS at credativ.com X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200403/197 X-Sequence-Number: 12766 Mark Lubratt wrote: > Obivously, I have a lot of sequential scans going on, at about what > cost does it start to make sense to make an index? Or, should I just > put in a bunch of indexes and let the optimizer decide whether or not > to use them? Read the chapters on Indexes and Performance Tips in the documentation. They contain various example scenarios where indexes are useful. Keep in mind that indexes are useful only if your table is large (say, 10000 rows or more) and the fraction you select is small (say, 1%). The costs that EXPLAIN prints out are not meaningful absolute values; they are only useful to compare two plans of the same query. So in absence of a better approach, your job is to 1. EXPLAIN ANALYZE without index 2. create index 3. EXPLAIN ANALYZE with index (And don't forget to run ANALYZE sometime.) If there is a significant improvement, then keep the index. Remember, too many indexes slow down updates.