Skip to content

Commit

Permalink
add doc for information_schema.variable_info (#9798)
Browse files Browse the repository at this point in the history
  • Loading branch information
ran-huang committed Aug 9, 2022
1 parent 7a8cf44 commit e211db5
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
1 change: 1 addition & 0 deletions TOC.md
Expand Up @@ -783,6 +783,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 that the system variable is only valid in the current session. `INSTANCE` means that the system variable is valid in the TiDB instance. `GLOBAL` means that the system variable is valid in the TiDB cluster.
* `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

0 comments on commit e211db5

Please sign in to comment.