MySQL Forums
Forum List  »  Newbie

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

Tried to check with only questions and choices by creating different dummy database

CREATE TABLE `questions` (
`question_id` int(5) unsigned NOT NULL AUTO_INCREMENT,
`question_text` varchar(255) NOT NULL,
`quiz_id` int(5) unsigned NOT NULL,
PRIMARY KEY (`question_id`),
KEY `quiz_id` (`quiz_id`)
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1

CREATE TABLE `choices` (
`choice_id` int(5) unsigned NOT NULL AUTO_INCREMENT,
`choice` varchar(100) NOT NULL,
`FK_question_id` int(5) NOT NULL,
PRIMARY KEY (`choice_id`),
KEY `FK_question_id` (`FK_question_id`)
) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=latin1

MySQL/dummy_quiz/ http://localhost/phpmyadmin/db_sql.php?db=dummy_quiz





Your browser has phpMyAdmin configuration for this domain. Would you like to import it for current session?
Yes
/ No
/ Delete settings



Your SQL query has been executed successfully.

explain select * from questions inner join choices on choices.FK_question_id = questions.question_id where quiz_id = 1



1 SIMPLE questions NULL ref PRIMARY,quiz_id quiz_id 4 const 1 100.00 NULL
1 SIMPLE choices NULL ref FK_question_id FK_question_id 4 dummy_quiz.questions.question_id 2 100.00 Using index condition


How does it work so good?
What is wrong with my multi-language design and query?

Options: ReplyQuote


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


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.