Re: Efficient IP address location lookup

2013-11-16 Thread Laing, Michael
This approach is similar to Janne's. But I used a shard as an example to make more even rows, and just converted each IP to an int. -- put this in and run using 'cqlsh -f DROP KEYSPACE jacob_test; CREATE KEYSPACE jacob_test WITH replication = { 'class': 'SimpleStrategy', 'replication_

Re: Efficient IP address location lookup

2013-11-16 Thread Janne Jalkanen
Idea: Put only range end points in the table with primary key (part, remainder) insert into location (part, remainder, city) values (100,10,Sydney) // 100.0.0.1-100.0.0.10 is Sydney insert into location (part, remainder, city) values (100,50,Melbourne) // 100.0.0.11-100.0.0.5 is Melb then look

Re: Efficient IP address location lookup

2013-11-15 Thread Jacob Rhoden
> On 16 Nov 2013, at 1:47 pm, Jon Haddad wrote: > Instead of determining your table first, you should figure out what you want > to ask Cassandra. Thanks Jon, Perhaps I should have been more clear. I need to efficiently look up the location of an IP address. >> On Nov 15, 2013, at 4:36 PM, Ja

Re: Efficient IP address location lookup

2013-11-15 Thread Jon Haddad
Instead of determining your table first, you should figure out what you want to ask Cassandra. What do you want to look up your data by? For each query you may need to store the data multiple times, which is perfectly reasonable and is recommended. On Nov 15, 2013, at 4:36 PM, Jacob Rhoden wr

Efficient IP address location lookup

2013-11-15 Thread Jacob Rhoden
Hi Guys, It occurs to me that someone may have done this before and be willing to share, or may just be interested in helping work out it. Assuming a database table where the partition key is the first component of a users IPv4 address, i.e. (ip=100.0.0.1, part=100) and the remaining three part