Re: Query not using index

From: Kaloyan Iliev <kaloyan(at)mbox(dot)digsys(dot)bg>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: Query not using index
Date: 2005-12-09 16:38:42
Message-ID: 4399B312.2080907@mbox.digsys.bg
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Kaloyan Iliev 2005-12-09 16:39:09 Re: Query not using index
Previous Message Frank Wiles 2005-12-09 15:58:36 Re: opinion on disk speed