Re: Optimize subquery, replace IN() with JOIN
Hello,
I have replied to Peter with link to show table and datas, but it's moderated so it's waiting forum moderator to allow it.
EXPLAIN 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 = '1842' ) AND content_typ = 'actual' ) ORDER BY date_add DESC LIMIT 10;
+------+--------------+---------------------+--------+------------------------------------+--------------+---------+-----------------------------------------------+------+----------------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+------+--------------+---------------------+--------+------------------------------------+--------------+---------+-----------------------------------------------+------+----------------------------------------------------+
| 1 | PRIMARY | content | range | PRIMARY,published,typ | published | 1 | NULL | 27 | Using index condition; Using where; Using filesort |
| 1 | PRIMARY | <subquery2> | eq_ref | distinct_key | distinct_key | 4 | func | 1 | |
| 2 | MATERIALIZED | category_content_se | ref | category_id,content_id | content_id | 4 | const | 7 | |
| 2 | MATERIALIZED | category_content_se | ref | category_id,content_id,content_typ | category_id | 4 | slobodna_main.category_content_se.category_id | 2 | Using where |
+------+--------------+---------------------+--------+------------------------------------+--------------+---------+-----------------------------------------------+------+----------------------------------------------------+
4 rows in set (0.00 sec)
Subject
Views
Written By
Posted
2172
November 15, 2016 02:37PM
877
November 15, 2016 03:34PM
972
November 15, 2016 04:25PM
865
November 17, 2016 08:11PM
791
November 22, 2016 02:44PM
847
November 16, 2016 04:03AM
846
November 16, 2016 12:51PM
979
November 16, 2016 03:22PM
824
November 16, 2016 04:44PM
588
December 27, 2016 05:32AM
734
November 16, 2016 01:50AM
Re: Optimize subquery, replace IN() with JOIN
770
November 16, 2016 04:01AM
929
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.