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
2960
November 15, 2016 02:37PM
1134
November 15, 2016 03:34PM
1405
November 15, 2016 04:25PM
1117
November 17, 2016 08:11PM
1081
November 22, 2016 02:44PM
1143
November 16, 2016 04:03AM
1139
November 16, 2016 12:51PM
1315
November 16, 2016 03:22PM
1103
November 16, 2016 04:44PM
932
December 27, 2016 05:32AM
1011
November 16, 2016 01:50AM
Re: Optimize subquery, replace IN() with JOIN
1082
November 16, 2016 04:01AM
1325
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.