我有这个mysql查询,我不知道什么索引查询中的所有字段的含义。我的意思是可以索引CASE语句中的所有字段,连接语句和Where语句?索引字段是否有任何性能影响?可以索引这个mysql查询中的所有字段吗?
SELECT roots.id as root_id, root_words.*,
CASE
WHEN root_words.title LIKE '%text%' THEN 1
WHEN root_words.unsigned_title LIKE '%normalised_text%' THEN 2
WHEN unsigned_source LIKE '%normalised_text%' THEN 3
WHEN roots.root LIKE '%text%' THEN 4
END as priorities
FROM roots INNER JOIN root_words ON roots.id=root_words.root_id
WHERE (root_words.unsigned_title LIKE '%normalised_text%') OR (root_words.title LIKE '%text%')
OR (unsigned_source LIKE '%normalised_text."%') OR (roots.root LIKE '%text%') ORDER by priorities
另外,如何进一步提高查询速度?
谢谢!