我有以下查询,在ram为32gb且处理器速度非常快且ssd
的服务器上执行需要10秒钟product_name有一个全文索引,product_description有一个全文索引,并且product_name和amp;都有一个全文索引。 product_description合并
如果我不使用布尔模式,我可以快速获得结果,但缺少所需的相关性
SET SESSION query_cache_type=0;
SELECT
p.sku,
p.product_name,
p.product_description,
( MATCH (p.product_name) AGAINST ('+word1 +word2 +word3' IN BOOLEAN MODE) * 10 ) AS score1,
( MATCH (p.product_description) AGAINST ('+word1 +word2 +word3' IN BOOLEAN MODE) * 20 ) AS score2,
( MATCH (p.product_name,p.product_description) AGAINST ('word1,word2,word3') * 30 ) AS score3
FROM products AS p
WHERE
(
( MATCH (p.product_name) AGAINST ('+word1 +word2 +word3' IN BOOLEAN MODE) * 10 ) > 0 OR
( MATCH (p.product_description) AGAINST ('+word1 +word2 +word3' IN BOOLEAN MODE) * 20 ) > 0 OR
( MATCH (p.product_name,p.product_description) AGAINST ('word1,word2,word3') * 30 )
) AND
p.sku NOT LIKE '4%'
ORDER BY score1 DESC,score2 DESC,score3 DESC LIMIT 0,15
解释显示"使用何处;使用filesort"这意味着查询未使用全文索引
如何加快查询速度?或者如何进一步解决问题?