Skip to content

Commit

Permalink
cherry pick pingcap#3265 to release-4.0
Browse files Browse the repository at this point in the history
Signed-off-by: sre-bot <[email protected]>
  • Loading branch information
JaySon-Huang authored and sre-bot committed May 29, 2020
1 parent 92647e4 commit b551145
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tidb-specific-system-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,7 @@ TiDB 默认会在建表时为新表分裂 Region。开启该变量后,会在

这个变量用来显示上一个 `execute` 语句所使用的执行计划是不是直接从 plan cache 中取出来的。

<<<<<<< HEAD
### ddl_slow_threshold

作用域:SESSION
Expand Down Expand Up @@ -866,10 +867,13 @@ TiDB 默认会在建表时为新表分裂 Region。开启该变量后,会在

这个变量用来设置一天中允许自动演进的结束时间。

=======
>>>>>>> adaf792... Add explaination about tidb_allow_batch_cop (#3265)
### tidb_allow_batch_cop <span class="version-mark">从 v4.0 版本开始引入</span>
作用域:SESSION | GLOBAL

<<<<<<< HEAD
默认值: 0

这个变量用于控制 TiDB 向 TiFlash 发送 coprocessor 请求的方式,有以下几种取值:
Expand Down Expand Up @@ -949,3 +953,10 @@ TiDB 默认会在建表时为新表分裂 Region。开启该变量后,会在
默认值: 60

这个变量设置了查询 METRIC_SCHEMA 时生成的 Prometheus 语句的 range duration,单位为秒。
=======
默认值:0

这个变量用来设置从 TiFlash 读取数据时,是否把 Region 的请求进行合并。

当查询的表拥有 TiFlash 副本,且查询涉及的 Region 数量比较多,可以尝试设置该变量为 `1`(对带 `aggregation` 下推到 TiFlash Coprocessor 的请求生效),或设置该变量为 `2`(对全部下推到 TiFlash Coprocessor 请求生效)。
>>>>>>> adaf792... Add explaination about tidb_allow_batch_cop (#3265)
15 changes: 15 additions & 0 deletions tiflash/tune-tiflash-performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,44 @@ aliases: ['/docs-cn/stable/reference/tiflash/tune-performance/']
set @@tidb_distsql_scan_concurrency = 80;
```

<<<<<<< HEAD
2. 开启 Super batch 功能:

[`tidb_allow_batch_cop`](/tidb-specific-system-variables.md#tidb_allow_batch_cop) 变量用来设置从 TiFlash 读取时,是否把 Region 的请求进行合并。当查询中涉及的 Region 数量比较大,可以尝试设置该变量为 `1`(对带 `aggregation` 下推到 TiFlash Coprocessor 的请求生效),或设置该变量为 `2`(对全部下推到 TiFlash Coprocessor 请求生效)。
=======
2. 开启 Super batch 功能:
[`tidb_allow_batch_cop`](/tidb-specific-system-variables.md#tidb_allow_batch_cop) 变量用来设置从 TiFlash 读取时,是否把 Region 的请求进行合并。当查询中涉及的 Region 数量比较大,可以尝试设置该变量为 `1`(对带 `aggregation` 下推到 TiFlash Coprocessor 的请求生效),或设置该变量为 `2`(对全部下推到 TiFlash Coprocessor 请求生效)。
>>>>>>> adaf792... Add explaination about tidb_allow_batch_cop (#3265)

{{< copyable "sql" >}}

```sql
set @@tidb_allow_batch_cop = 1;
```

<<<<<<< HEAD
3. 尝试开启聚合推过 `Join` / `Union` 等 TiDB 算子的优化:

[`tidb_opt_agg_push_down`](/tidb-specific-system-variables.md#tidb_opt_agg_push_down) 变量用来设置优化器是否执行聚合函数下推到 Join 之前的优化操作。当查询中聚合操作执行很慢时,可以尝试设置该变量为 1。
=======
3. 尝试开启聚合推过 `Join` / `Union` 等 TiDB 算子的优化:
[`tidb_opt_agg_push_down`](/tidb-specific-system-variables.md#tidb_opt_agg_push_down) 变量用来设置优化器是否执行聚合函数下推到 Join 之前的优化操作。当查询中聚合操作执行很慢时,可以尝试设置该变量为 1。
>>>>>>> adaf792... Add explaination about tidb_allow_batch_cop (#3265)

{{< copyable "sql" >}}

```sql
set @@tidb_opt_agg_push_down = 1;
```

<<<<<<< HEAD
4. 尝试开启 `Distince` 推过 `Join` / `Union` 等 TiDB 算子的优化:

[`tidb_opt_distinct_agg_push_down`](/tidb-specific-system-variables.md#tidb_opt_distinct_agg_push_down) 变量用来设置优化器是否执行带有 `Distinct` 的聚合函数(比如 `select count(distinct a) from t`)下推到 Coprocessor 的优化操作。当查询中带有 `Distinct` 的聚合操作执行很慢时,可以尝试设置该变量为 `1`。
=======
4. 尝试开启 `Distince` 推过 `Join` / `Union` 等 TiDB 算子的优化:
[`tidb_opt_distinct_agg_push_down`](/tidb-specific-system-variables.md#tidb_opt_distinct_agg_push_down) 变量用来设置优化器是否执行带有 `Distinct` 的聚合函数(比如 `select count(distinct a) from t`)下推到 Coprocessor 的优化操作。当查询中带有 `Distinct` 的聚合操作执行很慢时,可以尝试设置该变量为 `1`。
>>>>>>> adaf792... Add explaination about tidb_allow_batch_cop (#3265)

{{< copyable "sql" >}}

Expand Down

0 comments on commit b551145

Please sign in to comment.