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 `posts` ADD INDEX `posts_idx_blog_id_created_at` (`blog_id`,`created_at`);
ALTER TABLE `posts` ADD INDEX `posts_idx_created_at` (`created_at`);
SELECT
b.*,
(SELECT
p.created_at
FROM
posts p
WHERE
p.blog_id = b.id
ORDER BY
p.created_at DESC LIMIT 1) AS last_post_created_at
FROM
blogs b
ORDER BY
last_post_created_at DESC