Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sysvar: update doc for tidb_opt_prefer_range_scan #6859

Merged
merged 1 commit into from
Sep 6, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions system-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -1109,10 +1109,10 @@ mysql> desc select count(distinct a) from test.t;

### `tidb_opt_prefer_range_scan` <span class="version-mark">从 v5.0 版本开始引入</span>

- 作用域:SESSION
- 作用域:SESSION | GLOBAL
- 默认值:`OFF`
Copy link
Contributor

@TomShawn TomShawn Aug 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1/0,ON/OFF 是否需要统一一下呢?另外,这个属于 5.2 有的内容吗?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不属于 5.2 的内容,要不统一成 ON/OFF ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好的

- 将该变量值设为 `1` 后,优化器总是偏好索引扫描而不是全表扫描
- 在以下示例中,`tidb_opt_prefer_range_scan` 开启前,TiDB 优化器需要执行全表扫描。`tidb_opt_prefer_range_scan` 开启后,优化器选择了索引扫描
- 将该变量值设为 `1` 后,优化器总是偏好区间扫描而不是全表扫描
- 在以下示例中,`tidb_opt_prefer_range_scan` 开启前,TiDB 优化器需要执行全表扫描。`tidb_opt_prefer_range_scan` 开启后,优化器选择了索引区间扫描

```sql
explain select * from t where age=5;
Expand Down