I have the following query:
EXPLAIN EXTENDED SELECT *
FROM (
`photo_data`
)
LEFT JOIN `deleted_photos` ON `deleted_photos`.`photo_id` = `photo_data`.`photo_i
If you need just to compare field value in case-sensitive manner - you could change collation for that field specifically.
ALTER TABLE photo_data MODIFY photo_id VARCHAR(5) CHARACTER SET utf8 COLLATE utf8_bin
or
ALTER TABLE photo_data MODIFY photo_id VARCHAR(5) CHARACTER SET utf8 COLLATE utf8_general_cs
MySQL uses the collation of the column for the index. An index with a non-binary collation isn't useful for a binary lookup since the order might be different.
You could change the column itself to binary collation:
ALTER TABLE YourTable MODIFY
YourColumn VARCHAR(4)
CHARACTER SET latin1
COLLATE latin1_bin;
Then the index would be useful for a binary lookup.