Skip to content

Commit

Permalink
add doc for information_schema.variables_info (pingcap#10712)
Browse files Browse the repository at this point in the history
* add doc for information_schema.variables_info

* add toc and fix link

* Update information-schema/information-schema.md

* Update information-schema/information-schema-variables-info.md

Co-authored-by: Ran <huangran.alex@gmail.com>

* Update information-schema/information-schema-variables-info.md

Co-authored-by: Ran <huangran.alex@gmail.com>

* variables_scope -> variable_scope

* Apply suggestions from code review

Co-authored-by: shichun-0415 <89768198+shichun-0415@users.noreply.github.com>

Co-authored-by: Ran <huangran.alex@gmail.com>
Co-authored-by: shichun-0415 <89768198+shichun-0415@users.noreply.github.com>
  • Loading branch information
3 people authored Aug 2, 2022
1 parent 6181bee commit b6548c2
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
1 change: 1 addition & 0 deletions TOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,7 @@
- [`TIKV_REGION_STATUS`](/information-schema/information-schema-tikv-region-status.md)
- [`TIKV_STORE_STATUS`](/information-schema/information-schema-tikv-store-status.md)
- [`USER_PRIVILEGES`](/information-schema/information-schema-user-privileges.md)
- [`VARIABLES_INFO`](/information-schema/information-schema-variables-info.md)
- [`VIEWS`](/information-schema/information-schema-views.md)
- [`METRICS_SCHEMA`](/metrics-schema.md)
- UI
Expand Down
55 changes: 55 additions & 0 deletions information-schema/information-schema-variables-info.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
title: VARIABLES_INFO
summary: 了解 information_schema 表 `VARIABLES_INFO`。
---

# VARIABLES_INFO

`VARIABLES_INFO` 可用于查看当前 TiDB 集群或实例的系统变量默认值、当前值以及作用域等信息。

```sql
USE information_schema;
DESC variables_info;
```

```sql
+-----------------+---------------------+------+------+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------------+---------------------+------+------+---------+-------+
| VARIABLE_NAME | varchar(64) | NO | | NULL | |
| VARIABLE_SCOPE | varchar(64) | NO | | NULL | |
| DEFAULT_VALUE | varchar(64) | NO | | NULL | |
| CURRENT_VALUE | varchar(64) | NO | | NULL | |
| MIN_VALUE | bigint(64) | YES | | NULL | |
| MAX_VALUE | bigint(64) unsigned | YES | | NULL | |
| POSSIBLE_VALUES | varchar(256) | YES | | NULL | |
| IS_NOOP | varchar(64) | NO | | NULL | |
+-----------------+---------------------+------+------+---------+-------+
8 rows in set (0.00 sec)
```

```sql
SELECT * FROM variables_info ORDER BY variable_name LIMIT 3;
```

```sql
+-----------------------------------+----------------+---------------+---------------+-----------+-----------+-----------------+---------+
| VARIABLE_NAME | VARIABLE_SCOPE | DEFAULT_VALUE | CURRENT_VALUE | MIN_VALUE | MAX_VALUE | POSSIBLE_VALUES | IS_NOOP |
+-----------------------------------+----------------+---------------+---------------+-----------+-----------+-----------------+---------+
| allow_auto_random_explicit_insert | SESSION,GLOBAL | OFF | OFF | NULL | NULL | NULL | NO |
| auto_increment_increment | SESSION,GLOBAL | 1 | 1 | 1 | 65535 | NULL | NO |
| auto_increment_offset | SESSION,GLOBAL | 1 | 1 | 1 | 65535 | NULL | NO |
+-----------------------------------+----------------+---------------+---------------+-----------+-----------+-----------------+---------+
3 rows in set (0.01 sec)
```

`VARIABLES_INFO` 表中列的含义如下:

* `VARIABLE_NAME`:系统变量名称。
* `VARIABLE_SCOPE`:系统变量的作用域。`SESSION` 表示当前 session 可见;`INSTANCE` 表示当前 TiDB 实例可见;`GLOBAL` 表示集群内可见。
* `DEFAULT_VALUE`:系统变量的默认值。
* `CURRENT_VALUE`:系统变量的当前值。如果应用范围中包含 `SESSION`,则显示当前 session 的值。
* `MIN_VALUE`:数值类型的系统变量允许的最小值。如果变量值为非数值类型,则为 NULL。
* `MAX_VALUE`:数值类型的系统变量允许的最大值。如果变量值为非数值类型,则为 NULL。
* `POSSIBLE_VALUES`:系统变量所有可能的值。如果变量值不可枚举,则为 NULL。
* `IS_NOOP`:是否为 `noop` 的系统变量。
1 change: 1 addition & 0 deletions information-schema/information-schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Information Schema 提供了一种查看系统元数据的 ANSI 标准方法。
| `TABLE_PRIVILEGES` | TiDB 未实现,返回零行。 |
| `TRIGGERS` | TiDB 未实现,返回零行。 |
| [`USER_PRIVILEGES`](/information-schema/information-schema-user-privileges.md) | 汇总与当前用户相关的权限。 |
| [`VARIABLES_INFO`](/information-schema/information-schema-variables-info.md) | 提供 TiDB 系统变量的信息。 |
| [`VIEWS`](/information-schema/information-schema-views.md) | 提供当前用户可见的视图列表。类似于 `SHOW FULL TABLES WHERE table_type = 'VIEW'`|

## TiDB 中的扩展表
Expand Down

0 comments on commit b6548c2

Please sign in to comment.