Faster GeoIP Country on MySQL Database

If you want to see where your users are coming from, you can use MaxMind‘s GeoIP Country or GeoLite Country (Free version). The easiest way to do this is to download the database in CSV format and to import it into your MySQL database.

After doing that I noticed increase in load times of queries which uses that table. It was taking about 1500ms to refresh the online users page. Then I found out about MySQL’s Memory storage engine. I changed the table’s storage engine to Memory.

The increase in speed was dramatic. It took only 300ms to load the page. Basically what it does is to never remove the table from the memory. But I have to say if you restart MySQL server or reboot the machine you will have to import the table once again since all data will be gone.

Leave a Reply

Your email address will not be published. Required fields are marked *