I have tables with columns
blog_detail
- id INT PK, blog_id INT FK, language INT, title VARCHAR(255).
blog
- id INT PK, author_id INT FK, created DATETIME
I have indexes in table blog_detail
blog_id_language
- blog_id, language
blog_id
- blog_id
blog_id_title
- blog_id, title
Query is:
SELECT *
FROM `blog`
LEFT JOIN `blog_detail` ON `blog`.`id` = `blog_detail`.`blog_id`
WHERE (`blog`.`is_active` = 1)
AND (( `blog`.`id` LIKE "%fulltextsearch%")
OR (`blog_detail`.`title` LIKE "%fulltextsearch%")
)
MySQL choose index blog_id_language
that uses column that is not used at all.
Why MySQL does not choose only blog_id
without useless column language or blog_id_title
that is use both used columns?