Skip to content

Commit

Permalink
reference: add tidb session variable description about `tidb_allow_re…
Browse files Browse the repository at this point in the history
…move_auto_inc`
  • Loading branch information
bb7133 committed Sep 17, 2019
2 parents 439bb84 + 81f1734 commit fbefafe
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -636,3 +636,11 @@ select * from t, t1 where t.a=t1.a
默认值:0

TiDB 默认会在建表时为新表分裂 Region。开启该变量后,会在建表语句执行时,同步打散刚分裂出的 Region。适用于批量建表后紧接着批量写入数据,能让刚分裂出的 Region 先在 TiKV 分散而不用等待 PD 进行调度。为了保证后续批量写入数据的稳定性,建表语句会等待打散 Region 完成后再返回建表成功,建表语句执行时间会是关闭该变量的数倍。

### tidb_allow_remove_auto_inc <span class="version-mark">从 v2.1.8 和 v3.0.4 版本开始引入</span>

作用域:SESSION

默认值:0

这个变量用来控制是否允许通过 `ALTER TABLE MODIFY``ALTER TABLE CHANGE` 来移除某个列的 `auto_increment` 属性。默认为不允许。
2 changes: 2 additions & 0 deletions dev/reference/mysql-compatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ TiDB 实现自增 ID 的原理是每个 tidb-server 实例缓存一段 ID 值用
1. 客户端向 B 插入一条将 `id` 设置为 1 的语句 `insert into t values (1, 1)`,并执行成功。
2. 客户端向 A 发送 Insert 语句 `insert into t (c) (1)`,这条语句中没有指定 `id` 的值,所以会由 A 分配,当前 A 缓存了 [1, 30000] 这段 ID,所以会分配 1 为自增 ID 的值,并把本地计数器加 1。而此时数据库中已经存在 `id` 为 1 的数据,最终返回 `Duplicated Error` 错误。

另外,从 TiDB 2.1.18 和 3.0.4 版本开始,TiDB 将通过系统变量 `@@tidb_remove_auto_inc` 控制是否允许通过 `alter table modify``alter table change` 来移除列的 `auto_increment` 属性,默认是不允许移除。

### Performance schema

Performance schema 表在 TiDB 中返回结果为空。TiDB 使用 [Prometheus 和 Grafana](/dev/how-to/monitor/monitor-a-cluster.md) 来监测性能指标。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -443,3 +443,11 @@ set tidb_query_log_max_len = 20
默认值:0

TiDB 默认会在建表时为新表分裂 Region。开启该变量后,会在建表语句执行时,同步打散刚分裂出的 Region。适用于批量建表后紧接着批量写入数据,能让刚分裂出的 Region 先在 TiKV 分散而不用等待 PD 进行调度。为了保证后续批量写入数据的稳定性,建表语句会等待打散 Region 完成后再返回建表成功,建表语句执行时间会是关闭该变量的数倍。

### tidb_allow_remove_auto_inc <span class="version-mark">从 v2.1.8 版本开始引入</span>

作用域:SESSION

默认值:0

这个变量用来控制是否允许通过 `ALTER TABLE MODIFY``ALTER TABLE CHANGE` 来移除某个列的 `auto_increment` 属性。默认为不允许。
2 changes: 2 additions & 0 deletions v2.1/reference/mysql-compatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ TiDB 实现自增 ID 的原理是每个 tidb-server 实例缓存一段 ID 值用
1. 客户端向 B 插入一条将 `id` 设置为 1 的语句 `insert into t values (1, 1)`,并执行成功。
2. 客户端向 A 发送 Insert 语句 `insert into t (c) (1)`,这条语句中没有指定 `id` 的值,所以会由 A 分配,当前 A 缓存了 [1, 30000] 这段 ID,所以会分配 1 为自增 ID 的值,并把本地计数器加 1。而此时数据库中已经存在 `id` 为 1 的数据,最终返回 `Duplicated Error` 错误。

另外,从 TiDB 2.1.18 开始,TiDB 将通过系统变量 `@@tidb_remove_auto_inc` 控制是否允许通过 `alter table modify``alter table change` 来移除列的 `auto_increment` 属性,默认是不允许移除。

### Performance schema

Performance schema 表在 TiDB 中返回结果为空。TiDB 使用 [Prometheus 和 Grafana](/v2.1/how-to/monitor/monitor-a-cluster.md) 来监测性能指标。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -638,3 +638,11 @@ select * from t, t1 where t.a=t1.a
默认值:0

TiDB 默认会在建表时为新表分裂 Region。开启该变量后,会在建表语句执行时,同步打散刚分裂出的 Region。适用于批量建表后紧接着批量写入数据,能让刚分裂出的 Region 先在 TiKV 分散而不用等待 PD 进行调度。为了保证后续批量写入数据的稳定性,建表语句会等待打散 Region 完成后再返回建表成功,建表语句执行时间会是关闭该变量的数倍。

### tidb_allow_remove_auto_inc <span class="version-mark">从 v3.0.4 版本开始引入</span>

作用域:SESSION

默认值:0

这个变量用来控制是否允许通过 `ALTER TABLE MODIFY``ALTER TABLE CHANGE` 来移除某个列的 `auto_increment` 属性。默认为不允许。
2 changes: 2 additions & 0 deletions v3.0/reference/mysql-compatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ TiDB 实现自增 ID 的原理是每个 tidb-server 实例缓存一段 ID 值用
1. 客户端向 B 插入一条将 `id` 设置为 1 的语句 `insert into t values (1, 1)`,并执行成功。
2. 客户端向 A 发送 Insert 语句 `insert into t (c) (1)`,这条语句中没有指定 `id` 的值,所以会由 A 分配,当前 A 缓存了 [1, 30000] 这段 ID,所以会分配 1 为自增 ID 的值,并把本地计数器加 1。而此时数据库中已经存在 `id` 为 1 的数据,最终返回 `Duplicated Error` 错误。

另外,从 TiDB 3.0.4 版本开始,TiDB 将通过系统变量 `@@tidb_remove_auto_inc` 控制是否允许通过 `alter table modify``alter table change` 来移除列的 `auto_increment` 属性,默认是不允许移除。

### Performance schema

Performance schema 表在 TiDB 中返回结果为空。TiDB 使用 [Prometheus 和 Grafana](/v3.0/how-to/monitor/monitor-a-cluster.md) 来监测性能指标。
Expand Down

0 comments on commit fbefafe

Please sign in to comment.