Re: Query not using index
| От | Kaloyan Iliev |
|---|---|
| Тема | Re: Query not using index |
| Дата | |
| Msg-id | 4399B312.2080907@mbox.digsys.bg обсуждение исходный текст |
| Ответ на | Query not using index (Kaloyan Iliev <news1@faith.digsys.bg>) |
| Список | 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
В списке pgsql-performance по дате отправления: