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 `content_feeds` ADD INDEX `content_feeds_idx_content_type_id` (`content_type`,`id`);
ALTER TABLE `follows` ADD INDEX `follows_idx_follower_id_content_id` (`follower_id`,`content_feed_id`);
ALTER TABLE `posts` ADD INDEX `posts_idx_id` (`id`);
SELECT
*
FROM
posts AS p
WHERE
EXISTS (
SELECT
1
FROM
content_feeds AS cf
WHERE
cf.id = p.content_feed_id
AND cf.content_type = 'youtube'
AND EXISTS (
SELECT
1
FROM
follows
WHERE
follows.follower_id = 1
AND follows.content_feed_id = cf.id
)
)
ORDER BY
p.id DESC LIMIT 15