Explain mysql query statement

Source: Internet
Author: User

Description of the return value of the explain SQL statement performance test: www.2cto.com SQL code mysql> Explain SELECT 'content _ id', 'content _ old_id ', 'content _ hasimg ', 'content _ time_update ', 'content _ title_long', 'vhost _ content '. 'site _ id', 'site _ domain ', 'site _ name ', 'site _ state' FROM 'vhost _ content' left join 'vhost _ site' ON 'vhost _ content '. 'site _ id' = 'vhost _ site '. 'site _ id' WHERE 'content _ effect '= 1 AND 'content _ audit' = 1 D 'content _ publish '= 1 AND 'content _ time_update'> = '2017-12-16 'AND 'vhost _ content '. 'site _ id' LIKE '200' AND 1 = 1 order by 'content _ time_update 'desc LIMIT 0, 25; + ---- + ------------- + --------------- + ------- + certificate + -------------------- + --------- + ----------------------------- + ------ + ----------------------------- + | id | sel Ect_type | table | type | possible_keys | key | key_len | ref | rows | Extra | + ---- + ------------- + ------- + certificate + ------------------ + --------- + keys + ------ + keys + | 1 | SIMPLE | vhost_content | range | idx_content_site, refvhost_site483, idx_content_uptime, idx_content _ Publish | idx_content_site | 55 | NULL | 198 | Using where; Using filesort | 1 | SIMPLE | vhost_site | ref | PRIMARY | 54 | vhostdb. vhost_content.site_id | 1 | + ---- + ------------- + --------------- + ------- + others + -------------------- + --------- + others + ------ + --------------------------- + www. 2ct O.com Table: displays the Type of the database Table involved in the statement. This column is very important and shows the category used by the connection, whether the index is used, and the statement quality. The result values are: system> const> eq_ref> ref> fulltext> ref_or_null> index_merge> unique_subquery> index_subquery> range> index> ALL. Generally, make sure that the query reaches the range level at least. It is best to reach the ref level; otherwise, performance problems may occur. Possible_key: indicates which index mysql can use to find the row Key in the table: displays the Key (INDEX) actually used by mysql. If no index is selected, the Key is null. Key_len: displays the key length determined by mysql. If it is null, the length is null. The shorter the length, the better, without compromising accuracy. Ref: displays the column or constant used with the key to select rows from the table. Rows: displays the number of Rows that mysql considers to be checked when performing a query. Extra: contains detailed information about mysql queries.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.