When I look at the EXPLAIN
results, the key len
value is always calculated based on the actual column length multiplied on the maximum number of bytes for the chosen encoding. Say, for a varchar(64)
using utf8
encoding the key len is 192.
Does this number affect performance in any way and should I reduce it when possible? I mean, does it make MySQL to reserve some space somewhere that remain unused, or it's just a maximum possible value while the used space is based on the exact data length?
So the actual question is: if I have a column that contains only Latin letters and numbers, should I change its encoding to latin1
from utf8
in regard of the space occupied by the index/overall index performance?
key len
xnumber of rows
bytes of space. I think it's ratheractual row value
from each row + some minor overhead