From: | Michael Glaesemann <grzm(at)myrealbox(dot)com> |
---|---|
To: | Richard Jones <rich(at)annexia(dot)org> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: index for inet and >> (contains) function |
Date: | 2006-03-23 00:47:26 |
Message-ID: | A0B35ADB-E4B6-4531-BAD2-49F67837DB70@myrealbox.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Mar 23, 2006, at 1:35 , Richard Jones wrote:
> select countryid from iptocountry where network >> '1.2.3.4';
>
> Is there a suitable index that I can put on the network field to fix
> this?
Have you taken a look at the ip4r pgfoundry project?
http://pgfoundry.org/projects/ip4r/
From the README:
> Firstly and most importantly, the builtin types have no support for
> index lookups of the form (column >>= parameter), i.e. where you have
> a table of IP address ranges and wish to find which ones include a
> given IP address. This requires an rtree or gist index to do
> efficiently, and also requires a way to represent IP address ranges
> that do not fall precisely on CIDR boundaries.
ip4r is intended for IPv4 addresses (rather than both IPv4 and IPv6),
so if you're don't need IPv6, it might work well for you.
Michael Glaesemann
grzm myrealbox com
From | Date | Subject | |
---|---|---|---|
Next Message | Steven Brown | 2006-03-23 02:33:36 | Re: Enforcing serial uniqueness? |
Previous Message | Trent Shipley | 2006-03-23 00:39:12 | Re: Modular Type Libraries: was A real currency type |