Still, the performance difference may be miniscule, as mysql uses an index on "US.%"
. The performance degradation is mostly felt when searching for something like "%.US"
(the wildcard is in front). As it then does a tablescan without using indices.
EDIT: you can look at it like this:
Mysql internally stores varchar indices like trees with first symbol being the root and branching to each next letter.
So when searching for = "US"
it looks for U
, then goes one down step for S
and then another to make sure that is the end of the value. That's three steps.
Searching for LIKE "US.%"
it looks again for U
, then S
, then .
and then stops searching and displays the results - thats also three steps only as it cares not whether the value terminated there.
EDIT2: I'm in no way promoting such database denormalization, I just wanted to attract your attention that this matter may not be as straightforward as it seems at first glance.