What is the query plan in mysql
This article introduces the relevant knowledge of "what is the query plan in mysql". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
1. It is the plan content provided to the server by the optimizer based on the query statement. The way to query the plan is to add the EXPLAIN keyword before the query sentence.
SELECT city.name AS 'City', country.name AS' Country'FROM cityJOIN country ON (city.countrycode = country.code) WHERE country.code = 'GBR'LIMIT 5
2. Add EXPLAIN before the query sentence to see the query plan generated by the optimizer.
Skip everything except the end of the output and you can see the optimized query.
SELECT `world`.`city`.`Name`AS `City`, 'United Kingdom' AS `Country`FROM `world`.`city`JOIN `world`.`city`where (`world`.`city`.`CountryCode` =' GBR') LIMIT 5; this is the end of the content of "what is the query plan in mysql". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!