Re: Query not using index

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux