I know that my question is a little vague, but I feel that managing countries / addresses is actually quite common, so I would like to get some tips on my actual setup.
I have a database with a "country" column, previously it was a middle type type, acting as a foreign key for another table with actual country information (id, name and ISO3166-1 alpha2 code basically).
After some testing and benchmarking, I ended up getting all the country information in a php file, including / requiring it if necessary, and it was one or two orders of magnitude faster than a database query. (these are 278 countries).
Therefore, this seems to be the best approach, but I feel that something is wrong there, because people tend to do such things by reading from a table and not from a file, but I can’t understand what it would be , support or something like that?
In addition, I thought that as a key, instead of a two-digit identifier, there is a code with two ISO letters, it would be more readable for a person and in any case it is unique. I do not see a noticeable performance loss in the 400,000 row table, will it be an error if my database grows?
source
share