1

Does table/column character encoding have any impact on how the MySQL optimizer chooses join indexes?

I have a table that have the same columns and indexes on two servers, one server does a eq_ref under type and the other does ALL

Only difference I see is the character encoding. Could that be the cause query not using an index? In the database that isn't performing, one table is latin1 and the joining table is utf8.

1st Server

# id, select_type, table, partitions, type, possible_keys, key, key_len, ref, rows, filtered, Extra 1, PRIMARY, tx, , ALL, , , , , 234587263, 100.00, Using where; Using join buffer (Block Nested Loop)

2nd Server

# id, select_type, table, partitions, type, possible_keys, key, key_len, ref, rows, filtered, Extra 1, PRIMARY, tx, , eq_ref, PRIMARY, PRIMARY, 198, db1.log.hash, 1, 100.00,

1

I found my answer here. Quick answer is - they need to be the same collation/encoding to use an index. https://stackoverflow.com/questions/2266241/utf-8-vs-latin1-mysql-indexes-not-used-on-utf-8

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.