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_date` (`date`);
SELECT
COUNT(table.id),
COUNT(DISTINCT table.id),
table.date
FROM
table
GROUP BY
table.date
ORDER BY
table.date DESC LIMIT 8