Impact of indexes on individual table queries

Source: Internet
Author: User

" impact of indexes on individual table queries "

Impact of indexes on individual table queries
The index is used to quickly find a row with a specific value on a column. Without an index, MySQL had to start with the first record and then read through the entire table until it found the relevant line. The larger the table, the more time it takes.
If the table has an index to the column of the query, MySQL can quickly reach a location to find the middle of the data file, and there is no need to consider all the data. If a table has 1000 rows, this is at least 100 times times faster than sequential reads. Note that you need to access almost all 1000 rows, which are read in a faster order, because at this point we avoid disk pathfinding.
For example, a student table such as the following:

  

Thus, when we try to make a specific query on it, we have to do a full-table scan, which is very slow.
For example, we find all students who have failed in English.

If we create an index for the 中文版 column:

  

Therefore, the following query is executed

Mysql>select name,english from user WHERE english<60;
The result is: you should be able to find that this result differs from the non-indexed English column before it is sorted, the reason formally described above. Links: http://blog.csdn.net/tsuliuchao/article/details/4877157

  

Impact of indexes on individual table queries

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.