1

Looking for a simple answer : I have a website similar to https://whatismyip.com/ The visitor hits the site, and some data is output based on their IP address.

The IP records database is available in a binary file, or in a csv that can be imported into a database. https://lite.ip2location.com/database/ip-country-region-city-latitude-longitude-zipcode-timezone

Is there any advantage of having the data in the database? Because from what I have seen, the bin file + the php class file is reading the data very quickly.

  • You will simply have to measure that. It is absolutely no problem to write code that accesses the data faster than MySQL could do it, and while it is very likely that your php code falls into this category, only a benchmark will be able to answer this for sure. We also do not know if you have requirements that your php classes do not fulfill but that a database could. – Solarflare Jul 18 '18 at 14:03

1 Answers1

0

There is no clear advantages or disadvantages between binary file or CSV. It is really up to your usage model and programming preference.

If you are comfortable with SQL, then you can load the CSV into SQL servers. You can replicate the data to multiple servers if you want to scale out for better performance.

If you don't like to manage database servers, then you can query the simple BIN file. It is using file I/O to query the database. IP2Location optimized their BIN file so you get good performance. Database update is as simple as replacing the BIN file.

Michael C.
  • 1,410
  • 1
  • 9
  • 20