From 405b4877c2add7619a57e2393d5b57423714a71a Mon Sep 17 00:00:00 2001 From: xixirangrang <35301108+hfxsd@users.noreply.github.com> Date: Fri, 13 Aug 2021 14:13:09 +0800 Subject: [PATCH 1/2] Introduced 2 new variables --- system-variables.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/system-variables.md b/system-variables.md index 8a31979541327..38984ce3d85ba 100644 --- a/system-variables.md +++ b/system-variables.md @@ -996,6 +996,20 @@ For a system upgraded to v5.0 from an earlier version, if you have not modified - This variable is used to set whether the optimizer executes the optimization operation of pushing down the aggregate function to the position before Join, Projection, and UnionAll. - When the aggregate operation is slow in query, you can set the variable value to ON. +### `tidb_opt_limit_push_down_threshold` + +- Scope: SESSION | GLOBAL +- Default value: `100` +- Range: `[0, 2147483647]` +- This variable is used to push down the Limit and TopN operators to the threshold in TiKV. +- If the value of Limit or TopN is less than or equal to this threshold, then the Limit and TopN operators are forcibly pushed down to TiKV. This variable provides a solution when Limit or TopN cannot be pushed down due to estimation errors. + +### `tidb_opt_enable_correlation_adjustment` + +- Scope: SESSION | GLOBAL +- Default value: `ON` +- This variable is used for the optimizer whether to enable the method that estimates the number of rows based on column order correlation + ### tidb_opt_correlation_exp_factor - Scope: SESSION | GLOBAL From d9b686ffecdf343cc084e3ea678037ea7adca7b6 Mon Sep 17 00:00:00 2001 From: xixirangrang <35301108+hfxsd@users.noreply.github.com> Date: Fri, 20 Aug 2021 09:53:37 +0800 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com> --- system-variables.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/system-variables.md b/system-variables.md index 38984ce3d85ba..430c6a2843bc6 100644 --- a/system-variables.md +++ b/system-variables.md @@ -996,19 +996,19 @@ For a system upgraded to v5.0 from an earlier version, if you have not modified - This variable is used to set whether the optimizer executes the optimization operation of pushing down the aggregate function to the position before Join, Projection, and UnionAll. - When the aggregate operation is slow in query, you can set the variable value to ON. -### `tidb_opt_limit_push_down_threshold` +### tidb_opt_limit_push_down_threshold - Scope: SESSION | GLOBAL - Default value: `100` - Range: `[0, 2147483647]` -- This variable is used to push down the Limit and TopN operators to the threshold in TiKV. -- If the value of Limit or TopN is less than or equal to this threshold, then the Limit and TopN operators are forcibly pushed down to TiKV. This variable provides a solution when Limit or TopN cannot be pushed down due to estimation errors. +- This variable is used to set the threshold that determines whether to push the Limit or TopN operator down to TiKV. +- If the value of the Limit or TopN operator is smaller than or equal to this threshold, these operators are forcibly pushed down to TiKV. This variable resolves the issue that the Limit or TopN operator cannot be pushed down to TiKV partly due to wrong estimation. -### `tidb_opt_enable_correlation_adjustment` +### tidb_opt_enable_correlation_adjustment - Scope: SESSION | GLOBAL - Default value: `ON` -- This variable is used for the optimizer whether to enable the method that estimates the number of rows based on column order correlation +- This variable is used to control whether the optimizer estimates the number of rows based on column order correlation ### tidb_opt_correlation_exp_factor