X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A56483B779D for ; Thu, 16 Dec 2004 13:57:50 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 76248-10 for ; Thu, 16 Dec 2004 13:57:36 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id 125EE3B7783 for ; Thu, 16 Dec 2004 13:57:38 +0000 (GMT) Received: (qmail 7460 invoked by uid 500); 16 Dec 2004 14:10:25 -0000 Date: Thu, 16 Dec 2004 08:10:25 -0600 From: Bruno Wolff III To: Andreas Kretschmer Cc: pgsql-sql@postgresql.org Subject: Re: [despammed] question about index Message-ID: <20041216141025.GC2768@wolff.to> Mail-Followup-To: Andreas Kretschmer , pgsql-sql@postgresql.org References: <20041216104154.GA30578@mail.librelogiciel.com> <20041216110139.GA5899@Pinguin.wug-glas.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20041216110139.GA5899@Pinguin.wug-glas.de> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200412/106 X-Sequence-Number: 19726 On Thu, Dec 16, 2004 at 12:01:39 +0100, Andreas Kretschmer wrote: > > > > considering that almost 70% of the rows will be with 'VALUE1', 20% > > will be with 'VALUE2' and 10% will be with 'VALUE3' on the average. > > > > should I create an index to speedup the counts or not ? > > Yes. Indexes will probably not help in this case. Even when looking at 10% of the rows, a sequential scan is still going to be faster than an index scan in most cases.