Reputation: 4049
i use explain plan,but i am confused what is its real meaning.
explain extended
select *
from (select type_id from con_consult_type cct
where cct.consult_id = (select id
from con_consult
where id = 1))
cctt left join con_type ct on cctt.type_id = ct.id;
i google the derived is temporary table,but what is its sql of the temporary table?is ctt table?
and the step 2,is result of cctt left join con_type ct on cctt.type_id = ct.id
?
the FK_CONSULT_TO_CONSULT_TYPE is consult_id refer con_consult id column,
how to use the index in the sql?
get all results of ctt,and then use the index filter?
please help me explain what the explain meanings.
Upvotes: 1
Views: 56
Reputation: 2953
This is a bad query to learn the basics of the explain
output, there is simply too much happening with all the sub queries, and joins.
I can give a run down of some of the essentials;
To answer some of your questions;
FK_CONSULT_TO_CONSULT_TYPE
you dont have to do anything, the engine has allready picked this up as an index which is what the explain is saying.Upvotes: 1