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 51158D1B1A5 for ; Fri, 25 Jun 2004 13:01:16 -0300 (ADT) 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 81594-07 for ; Fri, 25 Jun 2004 16:01:08 +0000 (GMT) Received: from davinci.ethosmedia.com (server228.ethosmedia.com [209.128.84.228]) by svr1.postgresql.org (Postfix) with ESMTP id 21FD4D1B191 for ; Fri, 25 Jun 2004 13:01:07 -0300 (ADT) Received: from [63.195.55.98] (HELO spooky) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 5494779; Fri, 25 Jun 2004 09:02:47 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Organization: Aglio Database Solutions To: Georgos Siganos , pgsql-sql@postgresql.org Subject: Re: Question about a CIDR based query Date: Fri, 25 Jun 2004 09:00:08 -0700 User-Agent: KMail/1.4.3 References: In-Reply-To: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <200406250900.08312.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200406/263 X-Sequence-Number: 18208 Georgos, > select * from tmp where route >>= some_cidr Can you post an EXPLAIN ANALYZE for this? And when's the last time you ran ANALYZE on the table? > The index on route is not used and I get a sequential scan. The index is > used only for the <<= operator. Most likely Postgres thinks that the >>= query is returning 60% of your table, which makes indexes useless. -- Josh Berkus Aglio Database Solutions San Francisco