Re: [GENERAL] index for inet and >> (contains) function

2006-03-22 Thread Michael Glaesemann
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 READM

Re: [GENERAL] index for inet and >> (contains) function

2006-03-22 Thread SCassidy
<[EMAIL PROTECTED]> To: pgsql-general@postgresql.org Sent by: cc:

Re: [GENERAL] index for inet and >> (contains) function

2006-03-22 Thread Tom Lane
Richard Jones <[EMAIL PROTECTED]> writes: > 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? Not at the moment :-(. I think it might be possible to write a GIST opclass that could handle this, but there

[GENERAL] index for inet and >> (contains) function

2006-03-22 Thread Richard Jones
I've got a table like this: create table iptocountry ( network inet not null, countryid int not null references countries (id) ); The idea is that it contains mappings from IP address ranges to countries, something like this: insert into iptocountry values ('1.2.3.0/24', 33); It