mysql binary comparison doesnt use index

前端 未结 2 1912
我在风中等你
我在风中等你 2021-01-13 06:02

I have the following query:

EXPLAIN EXTENDED SELECT *
FROM (
`photo_data`
)
LEFT JOIN `deleted_photos` ON `deleted_photos`.`photo_id` = `photo_data`.`photo_i         


        
2条回答
  •  走了就别回头了
    2021-01-13 07:00

    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
    

提交回复
热议问题