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