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 `movie_rank` ADD INDEX `movie_rank_idx_id` (`id`);
SELECT
s.id,
s.date,
s.revenue,
(SELECT
movie_rank.rank
FROM
movie_rank
WHERE
movie_rank.id = s.id
ORDER BY
ABS(DATEDIFF(movie_rank.date,
s.date)) ASC LIMIT 1)
FROM
movie_sales s