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 `book_cat` ADD INDEX `book_cat_idx_cat_id_book_id` (`cat_id`,`book_id`);
ALTER TABLE `books` ADD INDEX `books_idx_id` (`id`);
SELECT
books.id,
books.title,
books.slug,
books.source_id,
books.thumb_url
FROM
books,
book_cat
WHERE
books.id = book_cat.book_id
AND book_cat.cat_id = 158
ORDER BY
books.id DESC LIMIT 50