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

add doc for information_schema.variable_info #9798

Merged
merged 3 commits into from Aug 9, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions TOC.md
Expand Up @@ -778,6 +778,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
@@ -0,0 +1,55 @@
---
title: VARIABLES_INFO
summary: Learn the `VARIABLES_INFO` information_schema table.
---

# VARIABLES_INFO

The `VARIABLES_INFO` table provides information about the default value, current value, and scope of system variables in the current TiDB instance or TiDB cluster.

```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)
```

Fields in the `VARIABLES_INFO` table are described as follows:

* `VARIABLE_NAME`: the name of the system variable.
* `VARIABLE_SCOPE`: the scope of the system variable. `SESSION` means the system variable is only valid in the current session. `INSTANCE` means the system variable is valid in the TiDB instance. `GLOBAL` means the system variable is valid in the TiDB cluster.
ran-huang marked this conversation as resolved.
Show resolved Hide resolved
* `DEFAULT_VALUE`: the default value of the system variable.
* `CURRENT_VALUE`: the current value of the system variable. If the scope includes `SESSION`, `CURRENT_VALUE` is the value in the current session.
* `MIN_VALUE`: the minimum value allowed for the system variable. If the system variable is not numeric, `MIN_VALUE` is NULL.
* `MAX_VALUE`: the maximum value allowed for the system variable. If the system variable is not numeric, `MAX_VALUE` is NULL.
* `POSSIBLE_VALUES`: the possible values of the system variable. If the system variable is not an enum type, `POSSIBLE_VALUES` is NULL.
* `IS_NOOP`: whether the system variable is a `noop` system variable.
1 change: 1 addition & 0 deletions information-schema/information-schema.md
Expand Up @@ -45,6 +45,7 @@ Many `INFORMATION_SCHEMA` tables have a corresponding `SHOW` command. The benefi
| `TABLE_PRIVILEGES` | Not implemented by TiDB. Returns zero rows. |
| `TRIGGERS` | Not implemented by TiDB. Returns zero rows. |
| [`USER_PRIVILEGES`](/information-schema/information-schema-user-privileges.md) | Summarizes the privileges associated with the current user. |
| [`VARIABLES_INFO`](/information-schema/information-schema-variables-info.md) | Provides information about TiDB system variables. |
| [`VIEWS`](/information-schema/information-schema-views.md) | Provides a list of views that the current user has visibility of. Similar to running `SHOW FULL TABLES WHERE table_type = 'VIEW'` |

## Tables that are TiDB extensions
Expand Down