X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 501129DCAB7 for ; Fri, 9 Dec 2005 12:39:12 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 23920-04 for ; Fri, 9 Dec 2005 12:39:11 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from danbo.digsys.bg (danbo.digsys.bg [192.92.129.13]) by postgresql.org (Postfix) with ESMTP id 9B7099DCAB6 for ; Fri, 9 Dec 2005 12:39:09 -0400 (AST) Received: from [193.68.6.22] (luke.digsys.bg [193.68.6.22]) by danbo.digsys.bg (8.11.6/8.10.1) with ESMTP id jB9Gd8C04078 for ; Fri, 9 Dec 2005 18:39:08 +0200 (EET) Message-ID: <4399B32D.4010508@faith.digsys.bg> Date: Fri, 09 Dec 2005 18:39:09 +0200 From: Kaloyan Iliev User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.12) Gecko/20051109 X-Accept-Language: bg, en, en-us MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Query not using index References: <4399500A.4020607@faith.digsys.bg> In-Reply-To: <4399500A.4020607@faith.digsys.bg> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/265 X-Sequence-Number: 16086 Hi all, Thanks for the reply. I made some more test and find out that the problem is with the <<= operator for the network type. Can I create index which to work with <<=. Because if I use = the index is used. But not for <<=. iplog=# explain analyze SELECT * iplog-# FROM croute iplog-# WHERE '193.68.0.10/32' <<= network; QUERY PLAN --------------------------------------------------------------------------------------------------------- Seq Scan on croute (cost=0.00..707.27 rows=4891 width=103) (actual time=10.313..29.621 rows=2 loops=1) Filter: ('193.68.0.10/32'::cidr <<= network) Total runtime: 29.729 ms (3 rows) iplog=# explain analyze SELECT * iplog-# FROM croute iplog-# WHERE '193.68.0.10/32' = network; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ Index Scan using croute_network_all on croute (cost=0.00..17.99 rows=4 width=103) (actual time=0.053..0.059 rows=1 loops=1) Index Cond: ('193.68.0.10/32'::cidr = network) Total runtime: 0.167 ms (3 rows) Waiting for replies. Thanks to all in advance. Kaloyan Iliev