From a0523dc99e7060b814ed1ef155aea9c5f1a8677b Mon Sep 17 00:00:00 2001 From: xuyifan <675434007@qq.com> Date: Thu, 26 Aug 2021 13:17:04 +0800 Subject: [PATCH] tiny fix --- choose-index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/choose-index.md b/choose-index.md index b2ebd30f61146..f7672d1afd4db 100644 --- a/choose-index.md +++ b/choose-index.md @@ -39,7 +39,7 @@ TiDB uses the following heuristic pre-rules to select indexes: + Rule 1: If an index satisfies "unique index with full match + no need to retrieve rows from a table (which means that the plan generated by the index is the IndexReader operator)", TiDB directly selects this index. -+ Rule 2: If an index satisfies "unique index + the need to retrieve rows from a table (which means that the plan generated by the index is the IndexReader operator)", TiDB selects the index with the smallest number of rows to be retrieved from a table as a candidate index. ++ Rule 2: If an index satisfies "unique index with full match + the need to retrieve rows from a table (which means that the plan generated by the index is the IndexReader operator)", TiDB selects the index with the smallest number of rows to be retrieved from a table as a candidate index. + Rule 3: If an index satisfies "ordinary index + no need to retrieve rows from a table + the number of rows to be read is less than the value of a certain threshold", TiDB selects the index with the smallest number of rows to be read as a candidate index. @@ -47,7 +47,7 @@ TiDB uses the following heuristic pre-rules to select indexes: The "index with full match" in the above rules means each indexed column has the equal condition. When executing the `EXPLAIN FORMAT = 'verbose' ...` statement, if the pre-rules match an index, TiDB outputs a NOTE-level warning indicating that the index matches the pre-rule. -In the following example, because the index `idx_b` meets the condition "unique index + the need to retrieve rows from a table" in rule 2, TiDB selects the index `idx_b` as the access path, and `SHOW WARNING` returns a note indicating that the index `idx_b` matches the pre-rule. +In the following example, because the index `idx_b` meets the condition "unique index with full match + the need to retrieve rows from a table" in rule 2, TiDB selects the index `idx_b` as the access path, and `SHOW WARNING` returns a note indicating that the index `idx_b` matches the pre-rule. ```sql mysql> CREATE TABLE t(a INT PRIMARY KEY, b INT, c INT, UNIQUE INDEX idx_b(b));