Optimize subquery, replace IN() with JOIN
Hello,
I have sql query with two in() subqueries, they are returning correct 10 sorted results, but complete query it's terrible slow, over 5 minutes waiting.
SELECT id, title, alias
FROM content
WHERE published = '1'
AND typ = 'actual'
AND id
IN (
SELECT content_id
FROM category_content_se
WHERE category_id
IN (
SELECT category_id
FROM category_content_se
WHERE content_id = '11430'
)
AND content_typ = 'actual'
)
ORDER BY date_add DESC
LIMIT 10
Can someone please help me how to write same query using JOINs ?
Server is MySQLv5.6
Subject
Views
Written By
Posted
Optimize subquery, replace IN() with JOIN
2415
November 15, 2016 02:37PM
983
November 15, 2016 03:34PM
1121
November 15, 2016 04:25PM
967
November 17, 2016 08:11PM
936
November 22, 2016 02:44PM
950
November 16, 2016 04:03AM
976
November 16, 2016 12:51PM
1084
November 16, 2016 03:22PM
931
November 16, 2016 04:44PM
734
December 27, 2016 05:32AM
842
November 16, 2016 01:50AM
890
November 16, 2016 04:01AM
1045
November 16, 2016 06:23AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.