From 40a51d14d5d26fe58f28df41c5497e8902a58888 Mon Sep 17 00:00:00 2001 From: Xiaozhen Liu Date: Wed, 18 Aug 2021 16:34:30 +0800 Subject: [PATCH] address comments --- choose-index.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/choose-index.md b/choose-index.md index 6f37462e007be..34a1a7388544c 100644 --- a/choose-index.md +++ b/choose-index.md @@ -29,7 +29,7 @@ Before introducing index selection, it is important to understand the ways TiDB ## Index selection rules -TiDB selects indexes based on rules or cost. the based rules include pre rules and Skyline-pruning. When selecting an index, TiDB tries the pre rule first. If an index satisfies a pre rule, TiDB directly selects the index. Otherwise, TiDB uses Skyline-pruning to exclude unqualified indexes, and then based on the cost estimation of each operator for accessing tables, selects the index with the lowest cost. +TiDB selects indexes based on rules or cost. The based rules include pre rules and skyline-pruning. When selecting an index, TiDB tries the pre rule first. If an index satisfies a pre rule, TiDB directly selects the index. Otherwise, TiDB uses skyline-pruning to exclude unsuitable indexes, and then based on the cost estimation of each operator for accessing tables, selects the index with the lowest cost. ### Selection based on rules @@ -78,9 +78,9 @@ Skyline-pruning is a heuristic filtering rule for indexes, which can reduce the - 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. -For these three dimensions, if the index `idx_a` is not worse than the index `idx_b` in all three dimensions and one of the dimensions is better than `idx_b`, then `idx_a` is preferred. When executing the `EXPLAIN FORMAT = 'verbose' ...` statement, if Skyline-pruning excludes some indexes, TiDB will output a NOTE level warning listing the reserved indexes after Skyline-pruning's exclusion. +For these three dimensions, if the index `idx_a` is not worse than the index `idx_b` in all three dimensions and one of the dimensions is better than `idx_b`, then `idx_a` is preferred. When executing the `EXPLAIN FORMAT = 'verbose' ...` statement, if skyline-pruning excludes some indexes, TiDB will output a NOTE level warning listing the reserved indexes after skyline-pruning's exclusion. -In the following example, the index `idx_b` and `idx_e` are both inferior to `idx_b_c`, so they are excluded by Skyline-pruning. The returned result of `SHOW WARNING` displays the remaining indexes after Skyline-pruning. +In the following example, the index `idx_b` and `idx_e` are both inferior to `idx_b_c`, so they are excluded by skyline-pruning. The returned result of `SHOW WARNING` displays the remaining indexes after skyline-pruning. ```sql mysql> CREATE TABLE t(a INT PRIMARY KEY, b INT, c INT, d INT, e INT, INDEX idx_b(b), INDEX idx_b_c(b, c), INDEX idx_e(e)); @@ -105,7 +105,7 @@ mysql> SHOW WARNINGS; ### Selection based on cost estimation -After using the Skyline-pruning rule to rule out inappropriate indexes, the selection of indexes is based entirely on the cost estimation. The cost estimation of accessing tables requires the following considerations: +After using the skyline-pruning rule to rule out inappropriate indexes, the selection of indexes is based entirely on the cost estimation. The cost estimation of accessing tables requires the following considerations: - The average length of each row of the indexed data in the storage engine. - The number of rows in the query range generated by the index.