I know my question see a bit vague, but I feel like managing the countries/addresses is actually something pretty common, so I would like to get some advices on my actual setup.
I have a database with a "country" column, previously it was a medium int type, acting as Foreign Key to another table with the actual information about the countries (id, name and ISO3166-1 alpha2 code mainly).
After some testing and benchmarking I ended up having all the countries information in a php file array instead, including/requiring it when needed, and it was like one or two orders of magnitude faster than querying the database. (they are 278 countries).
So apparently it's a better approach but I feel like there's something wrong because people normally tend to do this kind of stuff reading from a table instead from a file, but I can't figure out what would it be, is it easier to maintain or something like that?
Also, I was thinking of having the 2 letters ISO code as the key instead of a numeric id, it would be more human-readable and they are unique anyway. I see no noticeable performance loss in the 400.000 rows table, will this end up being an error if my database grows ?