MySQL manual version 5.0.20-mysql optimization (ii) (1) (3) _php tutorial

Source: Internet
Author: User
The connection type is the same as all, except that it scans the index tree only. It is usually faster than all, because the index file is usually smaller than the data file. MySQL uses this type of connection in cases where the field knowledge of a query is part of a separate index.


All


A full scan of the table will be done to federate the records obtained from the previous table. This is not a good time if the first table is not identified as const, which in other cases is usually very bad. Normally, you can make records faster from the table by increasing the index to avoid all.


Possible_keys


The Possible_keys field refers to which index MySQL may use when searching for table records. Note that this field is completely independent of the table order displayed by EXPLAIN. This means that the index contained within the Possible_keys may not be used in actual use. If the value of this field is NULL, it means that no index is used. In this case, you can examine which fields in the WHERE clause are appropriate for increasing the index to improve the performance of the query. So, create the index, and then check it with EXPLAIN. See section "14.2.2 ALTER TABLE Syntax" for a detailed view. If you want to see what index the table has, you can see it by SHOW index from Tbl_name.


Key


The key field shows the actual index that MySQL will use. When no index is used, the value of this field is NULL. To make MySQL use or ignore the list of indexes in the Possible_keys field, you can use the Keyword Force index in the query statement, using index, or IGNORE index. If you are a MyISAM and BDB type table, you can use ANALYZE table to help analyze which index is better to use. If it is a MyISAM type table, running the command Myisamchk--analyze is the same effect. Details can be viewed in the section "14.5.2.1 ANALYZE table Syntax" and "5.7.2 table maintenance and Crash Recovery".


Key_len


The Key_len field shows the length of the index used by MySQL. When the value of the key field is null, the length of the index is null. Note that the value of Key_len can tell you what indexes MySQL will actually use in the federated index.

http://www.bkjia.com/PHPjc/630971.html www.bkjia.com true http://www.bkjia.com/PHPjc/630971.html techarticle The connection type is the same as all, except that it scans the index tree only. It is usually faster than all, because the index file is usually smaller than the data file. MySQL in query field knowledge separate index ...

  • 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.