我有這個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
另外,如何進一步提高查詢速度?
謝謝!