IP address geolocation SQL database
iplocationtools.com
iplocationtools.com
Edit: if you make sure entries are sorted and every entry has an unique incremental contiguous ID then you can even implement binary search via SQL itself with just few primary key lookups (few = log_2(N))
Btw, if you really need high performance here use a key-value DB and just store all the 2^24 entries (16 million), then just drop the last ".xxx" from the IP and perform a single lookup that will return the "id" of the place. Then retrieve place:<id> key to get the real location.
Or a real relational database configured with a "key" column and a "value" column and let the wonders of proper clustering and indexing provide you with the data in realtime no matter what load you put on it, because this dataset is shit tiny.
No really. I'm dead serious.
If you feel like optimizing this further, you can ofcourse also save memory by shifting countries and cities to separate tables, this reducing the size of the dataset noticeably, maybe by up to 40%.
I'm just shaking my head at all the "database problems" MySQL users invent to excuse their choice of subpar DB.
Recently I made a traceroute visualization mashup with their database (http://www.janitha.com/geoiptracer) just enter a list of IP's and it will draw lines connecting them in order.
Talking about geolocation, another shameless plug for my weekend project, a phonenumber-geolocation mashup http://www.janitha.com/telmapper
You could use the XML API as well.
Not to put down this person's/people's work, but don't do IP geolocation with MySQL if performance is of any importance to you. Use the binary database that Maxmind provides and you can get much better performance with almost no extra effort.
Please explain to me why databases is a bad choice for data which you wish to retrieve in ranges.
If you've clustered, stored and pre-sorted the data according to the range you wish to extract, this is probably the fastest way on the planet to retrieve the data.
Or is this simply more of that good, old MySQLism? You know, the "MySQL can't do it efficiently, so databases sucks"-mantra?
but don't do IP geolocation with MySQL if performance is of any importance to you.
If you remove the "IP geolocation with" part, I think we have a winner.