这种MySQL-Query此刻很慢。这种慢MySQL查询的最佳索引是什么? (InnoDB)
这会加速它的最佳指数是什么? (InnoDB)
SELECT item_id,
Group_concat(storage_nr SEPARATOR ',') AS storage_nr,
Group_concat(condition SEPARATOR ',') AS condition,
Group_concat(number SEPARATOR ',') AS number,
Group_concat(price SEPARATOR ',') AS price,
last_calc
FROM items
WHERE number > 0
AND bottomlimit IS NOT NULL
AND condition IN (1, 2, 3)
AND (price_date IS NULL
OR price_date < Date_sub(Now(), INTERVAL 1 hour))
AND (NOT (price = bottomlimit
AND pricebefore = bottomlimit
AND pricebefore2 = bottomlimit)
OR price IS NULL
OR pricebefore IS NULL
OR pricebefore2 IS NULL
OR Date(price_date) <> Curdate())
GROUP BY item_id
ORDER BY last_calc
LIMIT 20
非常感谢!
此致敬礼!
我的第一个倾向是无望的。我认为你的查询必须处理大量数据,这是必要的。 –
目前有哪些指数? – Uueerdo
我已经有数字,item_id,last_calc,bottomlimit和条件的单一索引。 我不确定创建组别indicie会不会更好。 – Webbox