Skip to content

Commit

Permalink
Update choose-index.md
Browse files Browse the repository at this point in the history
  • Loading branch information
TomShawn committed Aug 20, 2021
1 parent 27ea66c commit d5545ab
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions choose-index.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ mysql> SHOW WARNINGS;

Skyline-pruning is a heuristic filtering rule for indexes, which can reduce the probability of wrong index selection caused by wrong estimation. To judge an index, the following three dimensions are needed:

- How many access conditions are covered by the indexed columns. An “access condition” is a where condition that can be converted to a column range. And the more access conditions an indexed column set covers, the better it is in this dimension.

- Whether it needs to retrieve rows from a table when you select the index to access the table (that is, the plan generated by the index is IndexReader operator or IndexLookupReader operator). Indexes that do not retrieve rows from a table are better on this dimension than indexes that do. If both indexes need TiDB to retrieve rows from the table, compare how many filtering conditions are covered by the indexed columns. Filtering conditions mean the `where` condition that can be judged based on the index. If the column set of an index covers more access conditions, the smaller the number of retrieved rows from a table, and the better the index is in this dimension.

- Select whether the index satisfies a certain order. Because index reading can guarantee the order of certain column sets, indexes that satisfy the query order are superior to indexes that do not satisfy on this dimension.
Expand Down

0 comments on commit d5545ab

Please sign in to comment.