php - MySQL insert country iso or country id from another table -


i want insert each visitor's country in database. maxmind returns 2 letters country iso store in varchar(2), use 2 bytes, or, alternatively, can use unsigned tinyint use 1 byte, , id table countries.

however hit bump; need myisam engine fast insertions, myisam not support foreign keys, guess each insertion, have make select in countries table retrieve country id.

i don't know best option, absolutely need use myisam there lots of insertions don't want make selects retrieve country id.

if need 2-letter iso country code (and not country name, language, or other information) i'd storing char(2) no external table less resource-intensive storing smallint (tinyint wouldn't enough cover countries) lookup additional table.

note: there no need varchar(2) in case, char(2) more efficient.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -