Hi Alexander,
Yes, for queries that read low-valued and high-valued IPs you will get good performance by using these two indices. You'll probably still have performance problems with IPs in the middle of the range.
> Also, to my understanding, since the value to return (country) is also in the index, MySQL doesn't have to fetch the value from the table, but directly takes it from the index, yes? Not that it has much impact in this case, but I just want to understand the workings a bit more.
I suggest you take a look at these [1] pages in the documentation. It answers this and probably quite a few more questions you have :-)
[1]
http://dev.mysql.com/doc/refman/5.5/en/execution-plan-information.html and
http://dev.mysql.com/doc/refman/5.5/en/explain-output.html (See "Using index")
Hope this helps,
Jørgen Løland
Software Engineer, MySQL, Oracle
jorgenloland.blogspot.com