主表中的where条件加了组合索引,但还是出现了:using temporary, using filesort
请教各位大神,如何优化
谢谢!
EXPLAIN SELECT DISTINCT
(store_id),
c.id,
title,
count,
CODE,
time,
type
FROM
product AS p
LEFT JOIN store AS s ON (p.store_id = s.id)
WHERE
s. STATUS = 'active'
AND (
s.image != ''
OR s.image IS NOT NULL
)
AND p.is_active = 'yes'
AND is_available = '1'
AND title <> ''
AND type = 'code'
AND (
time != '0000-00-00 00:00:00'
OR time > now()
)
AND store_id NOT IN (
1,
2,
)
ORDER BY
id DESC
LIMIT 1000
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…