In case you have your own slow SQL query, you can optimize it automatically here.
For the query above, the following recommendations will be helpful as part of the SQL tuning process.
You'll find 3 sections below:
ALTER TABLE `table` ADD INDEX `table_idx_topic` (`topic`);
SELECT
table.topic,
COUNT(table.topic) AS topicCount
FROM
table
WHERE
datetime > DATE_SUB(NOW(), INTERVAL 24 HOUR)
AND table.topic != ''
GROUP BY
table.topic
HAVING
topicCount > 1
ORDER BY
topicCount DESC LIMIT 10