Samsung index in high-performance MySQL

Source: Internet
Author: User

Samsung index in high-performance MySQL

I have a deep question about this:

One star: What does the relevant record mean?? (The word is very esoteric, what is the department of "related department")

Two stars: If the B-tree (B+tree) index is established, the data is ordered.
Samsung: The indexed column contains all the columns that the query requires? There is no need to index all the columns on the WHERE query condition!

I think that the one-and two-star rows should be columns, and the index is not related to the specific data rows, but only to the columns of the query. This is also in line with the view of the multi-column index mentioned later in the high performance MySQL, in particular the two-star evaluation.

Personal point of view:

Evaluate whether an index is suitable for a "Samsung system" (Three-start systems) for a query:
One-star: The index puts the related columns together, that is, to index on a column of necessary columns, without having to index the columns in the Where condition.
Two-star: the Order of data columns in the index is the same as the order of the rows in the lookup. Typically, the highest-selectivity columns are placed at the forefront of the index.
Samsung: The columns in the index contain all the columns that are required in the query. The index contains the data columns required by the query and no longer a full table lookup (clustered index, overwrite index).

Resources:

"High performance MySQL" Chinese third edition

"High Performance MySQL (3rd Edition)" in English third edition

SQL Quantization method
U? Case 3: Samsung index (LNAME,CITY,FNAME,CNO)
RT = 1 * 10ms + 1000*0.1ms = 0.1 s
One random read, 1000 row scan

U? Case 4: two star index (lname,city,fname)
RT = 1 * 10ms + + * 0.1ms + + * 10ms= 10.11s
Random Read, 1000-line scan, 1000-time random IO
U? Case 5: one-star index (lname,city)
Rt= 1 * 10ms + + * 0.1ms + + * 10ms + + * 0.01ms=10.12s
Random Read, 1000-line scan, 1000 random io,1000 row sorting

Samsung index in high-performance MySQL

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.