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 1C8AD9DCB62 for ; Fri, 9 Dec 2005 13:01:53 -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 26994-05 for ; Fri, 9 Dec 2005 13:01:51 -0400 (AST) X-Greylist: delayed 00:23:01.836203 by SQLgrey- Received: from danbo.digsys.bg (danbo.digsys.bg [192.92.129.13]) by postgresql.org (Postfix) with ESMTP id 87E859DCAB7 for ; Fri, 9 Dec 2005 13:01:49 -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 jB9GcfC04060 for ; Fri, 9 Dec 2005 18:38:45 +0200 (EET) Message-ID: <4399B312.2080907@mbox.digsys.bg> Date: Fri, 09 Dec 2005 18:38:42 +0200 From: Kaloyan Iliev Reply-To: kaloyan@digsys.bg Organization: Digital Systems 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=windows-1251; 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/280 X-Sequence-Number: 16101 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