X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id D37EBD1B4EC for ; Wed, 1 Oct 2003 18:16:45 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 94345-03 for ; Wed, 1 Oct 2003 15:16:00 -0300 (ADT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by svr1.postgresql.org (Postfix) with ESMTP id D80E8D1B547 for ; Wed, 1 Oct 2003 15:15:26 -0300 (ADT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 3F1FE352F2; Wed, 1 Oct 2003 11:15:27 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 3DAD635263; Wed, 1 Oct 2003 11:15:27 -0700 (PDT) Date: Wed, 1 Oct 2003 11:15:27 -0700 (PDT) From: Stephan Szabo To: CN Cc: pgsql-sql@postgresql.org Subject: Re: Creating Index In-Reply-To: <20031001152542.8C9C76F692@smtp.us2.messagingengine.com> Message-ID: <20031001110830.O40704@megazone.bigpanda.com> References: <20031001152542.8C9C76F692@smtp.us2.messagingengine.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/17 X-Sequence-Number: 15417 On Wed, 1 Oct 2003, CN wrote: > Peter, Thanks a lot! > > > Unqualified count() cannot use an index because it has to visit all the > > rows in the table. > > It is only for my test. In my real practice, queries like > "SELECT * FROM view1 WHERE year = 2003 AND month BETWEEN 10 AND 12" > will be performed. You do realize that extract returns a double precision value not an integer, and it's probably not going to be willing to push clauses down through the union where the types are different .