我有這個疑問如何優化這一複雜的MySQL查詢
SELECT id, number, count, name FROM temp AS t1 WHERE (SELECT COUNT(*) FROM temp AS t2 WHERE t2.number = t1.number AND t2.count > t1.count ) = 0 AND id NOT IN (SELECT id FROM temp WHERE count < 3)
其目前的時間太長執行,表溫度有150個000行和增加。
我通過php(mysqli)運行這個。我怎樣才能提高性能?