This blog post has moved. Please find it at:
http://www.mpopp.net/2005/10/locate-ip-addresses/.
Sunday, October 02, 2005
Subscribe to:
Post Comments (Atom)
This is all about db4free.net and the database systems that it offers. The main focus are practical examples of the new features of MySQL 5 and 6 that should show you how to use them for your advantage in your daily life ;-).
5 comments:
thank you :)
Many Thanks ... very helpful ...
You can also show an image on your website to show visitor IP address and country flag. Just go to the website findmyipaddress.info. copy the code and paste it in your website
Just a hint, mysql already has INET_ATON() builtin function to convert an IP address to it's numeric representation.
I found that when using ip's from Australia the query time was significantly higher, and would at some stage stop using the index for table "b" (ip_countries) and perform a full search.
I wrote up a different query which seems to work a treat:
select straight_join b.country from ip_ranges a, ip_countries b where a.ip_from<=3405775035 and a.ip_to>=3405775035 and b.code=a.code limit 1;
The straight_join ensures that the table join order is the same as described in the from section of the query, and that the index is used.
Post a Comment