Search Postgresql Archives

Re: slow inet within cidr query

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

 




On Nov 28, 2006, at 12:07 PM, Edwin Grubbs wrote:

Under postgres 8.1, the "<<=" comparison yields very slow queries with large tables. I can rewrite the query without the "<<=" operator by generating all 33 possible netmasks (0 through 32) for a given IP. This ugly rewrite runs about 12 times faster (6 seconds versus 0.5 seconds). Be aware that EXPLAIN ANALYZE seems to be run a different query plan since the first query runs even slower with EXPLAIN ANALYZE. Setting enable_seqscan did not improve the query speed.

GiST opclasses for inet to make <<= indexable would be nice,
but I don't think anyones done them yet.

Depending on exactly what you're doing you might want to look at
http://pgfoundry.org/projects/ip4r and see if that'll do what you need.
It's not a drop-in replacement, though, so would be a pain to use
with existing code.

Cheers,
  Steve




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux