MySQL Forums
Forum List  »  Newbie

Re: EXPLAIN shows optimized query
Posted by: Mahesh Kumar
Date: October 31, 2017 10:37AM

mysql> explain SELECT * FROM `questions` INNER JOIN `question_multilingual` ON `questions`.`question_id` = `question_multilingual`.`FK_question_id` INNER JOIN `choices` ON `questions`.`question_id` = `choices`.`FK_question_id` INNER JOIN `choice_multilingual` ON `choice_multilingual`.`FK_choice_id` = `choices`.`choice_id` WHERE `questions`.`FK_quiz_id` = '1' AND `choice_multilingual`.`FK_language_id` = 2 AND `question_multilingual`.`FK_language_id` = 2 GROUP BY `questions`.`question_id` ORDER BY RAND();
+----+-------------+-----------------------+------------+--------+------------------------+----------------+---------+----------------------------------------------+------+----------+----------------------------------------------+
| id | select_type | table                 | partitions | type   | possible_keys          | key            | key_len | ref                                          | rows | filtered | Extra                                        |
+----+-------------+-----------------------+------------+--------+------------------------+----------------+---------+----------------------------------------------+------+----------+----------------------------------------------+
|  1 | SIMPLE      | question_multilingual | NULL       | ALL    | FK_question_id         | NULL           | NULL    | NULL                                         |   20 |    10.00 | Using where; Using temporary; Using filesort |
|  1 | SIMPLE      | questions             | NULL       | eq_ref | PRIMARY,FK_quiz_id     | PRIMARY        | 4       | quizzes.question_multilingual.FK_question_id |    1 |   100.00 | Using where                                  |
|  1 | SIMPLE      | choices               | NULL       | ref    | PRIMARY,FK_question_id | FK_question_id | 4       | quizzes.question_multilingual.FK_question_id |    3 |   100.00 | NULL                                         |
|  1 | SIMPLE      | choice_multilingual   | NULL       | eq_ref | FK_choice_id           | FK_choice_id   | 6       | quizzes.choices.choice_id,const              |    1 |   100.00 | NULL                                         |
+----+-------------+-----------------------+------------+--------+------------------------+----------------+---------+----------------------------------------------+------+----------+----------------------------------------------+
4 rows in set, 1 warning (0.00 sec)

Options: ReplyQuote


Subject
Written By
Posted
October 31, 2017 03:11AM
Re: EXPLAIN shows optimized query
October 31, 2017 10:37AM


Sorry, only registered users may post in this forum.

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.