From 4dbcee31de4bd1f85516ed6d95acc9d825e0dc1c Mon Sep 17 00:00:00 2001 From: guo-shaoge Date: Mon, 24 Jan 2022 11:19:48 +0800 Subject: [PATCH] update doc for IndexMerge GA (#7348) --- explain-index-merge.md | 8 ++++---- optimizer-hints.md | 4 ++-- system-variables.md | 10 +++++++++- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/explain-index-merge.md b/explain-index-merge.md index e72aa0487c330..7378ce21952f6 100644 --- a/explain-index-merge.md +++ b/explain-index-merge.md @@ -36,10 +36,10 @@ For the scan operation that is performed on a specific range of data, such as `I > **Note:** > -> At present, the `IndexMerge` feature is disabled by default in TiDB 4.0.0-rc.1. In addition, the currently supported scenarios of `IndexMerge` in TiDB 4.0 are limited to the disjunctive normal form (expressions connected by `or`). The conjunctive normal form (expressions connected by `and`) will be supported in later versions. Enable the `IndexMerge` in one of two ways: +> - The Index Merge feature is enabled by default from v5.4.0. That is, [`tidb_enable_index_merge`](/system-variables.md#tidb_enable_index_merge-new-in-v40) is `ON`. > -> - Set `tidb_enable_index_merge=1`; +> - You can use the SQL hint [`USE_INDEX_MERGE`](/optimizer-hints.md#use_index_merget1_name-idx1_name--idx2_name-) to force the optimizer to apply Index Merge, regardless of the setting of `tidb_enable_index_merge`. To enable Index Merge when the filtering conditions contain expressions that cannot be pushed down, you must use the SQL hint [`USE_INDEX_MERGE`](/optimizer-hints.md#use_index_merget1_name-idx1_name--idx2_name-). > -> - Use the SQL Hint [`USE_INDEX_MERGE`](/optimizer-hints.md#use_index_merget1_name-idx1_name--idx2_name-) in the query. +> - Index Merge supports only disjunctive normal form (expressions connected by `or`) and does not support conjunctive normal form (expressions connected by `and`). > -> SQL Hint has a higher priority than system variables. \ No newline at end of file +> - Index Merge is not supported in [tempoaray tables](/temporary-tables.md) for now. diff --git a/optimizer-hints.md b/optimizer-hints.md index 5422385d3ffaf..51292e56457f7 100644 --- a/optimizer-hints.md +++ b/optimizer-hints.md @@ -236,7 +236,6 @@ When multiple `USE_INDEX_MERGE` hints are made to the same table, the optimizer This hint takes effect on strict conditions, including: - If the query can select a single index scan in addition to full table scan, the optimizer does not select index merge. -- If the query is in an explicit transaction, and if the statements before this query has already written data, the optimizer does not select index merge. ## Hints that take effect in the whole query @@ -262,7 +261,8 @@ In addition to this hint, setting the `tidb_enable_index_merge` system variable > **Note:** > -> `NO_INDEX_MERGE` has a higher priority over `USE_INDEX_MERGE`. When both hints are used, `USE_INDEX_MERGE` does not take effect. +> - `NO_INDEX_MERGE` has a higher priority over `USE_INDEX_MERGE`. When both hints are used, `USE_INDEX_MERGE` does not take effect. +> - For a subquery, `NO_INDEX_MERGE` only takes effect when it is placed at the outermost level of the subquery. ### USE_TOJA(boolean_value) diff --git a/system-variables.md b/system-variables.md index 9456cdf1e5afb..c80c178182af1 100644 --- a/system-variables.md +++ b/system-variables.md @@ -758,9 +758,17 @@ Constraint checking is always performed in place for pessimistic transactions (d ### tidb_enable_index_merge New in v4.0 - Scope: SESSION | GLOBAL -- Default value: `OFF` +- Default value: `ON` - This variable is used to control whether to enable the index merge feature. +> **Note:** +> +> - After upgrading a TiDB cluster from versions earlier than v4.0.0 to v5.4.0 or later, this variable is disabled by default to prevent performance regression due to changes of execution plans. +> +> - After upgrading a TiDB cluster from v4.0.0 or later to v5.4.0 or later, this variable remains the setting before the upgrade. +> +> - Since v5.4.0, for a newly deployed TiDB cluster, this variable is enabled by default. + ### tidb_enable_list_partition New in v5.0 > **Warning:**