Skip to content

Commit

Permalink
sysvar: update doc for tidb_opt_prefer_range_scan (#6859)
Browse files Browse the repository at this point in the history
  • Loading branch information
xuyifangreeneyes committed Sep 6, 2021
1 parent 91b6943 commit b5e7456
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions system-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -1128,10 +1128,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`
- 将该变量值设为 `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

0 comments on commit b5e7456

Please sign in to comment.