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

Update SHOW STATUS docs #15917

Merged
merged 4 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions TOC-tidb-cloud.md
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@
- [Metadata Lock](/metadata-lock.md)
- [Use UUIDs](/best-practices/uuid.md)
- [System Variables](/system-variables.md)
- [Server Status Variables](/status-variables.md)
- Storage Engines
- TiKV
- [TiKV Overview](/tikv-overview.md)
Expand Down
1 change: 1 addition & 0 deletions TOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,7 @@
- [Introduction](/tidb-distributed-execution-framework.md)
- [TiDB Global Sort](/tidb-global-sort.md)
- [System Variables](/system-variables.md)
- [Server Status Variables](/status-variables.md)
- Configuration File Parameters
- [tidb-server](/tidb-configuration-file.md)
- [tikv-server](/tikv-configuration-file.md)
Expand Down
3 changes: 2 additions & 1 deletion sql-statements/sql-statement-flush-status.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ mysql> show status;

## MySQL compatibility

* This statement is included only for compatibility with MySQL.
* This statement is compatible with MySQL.

## See also

* [SHOW \[GLOBAL|SESSION\] STATUS](/sql-statements/sql-statement-show-status.md)
* [Server Status Variables](/status-variables.md)
82 changes: 46 additions & 36 deletions sql-statements/sql-statement-show-status.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,56 +5,66 @@ summary: An overview of the usage of SHOW [GLOBAL|SESSION] STATUS for the TiDB d

# SHOW [GLOBAL|SESSION] STATUS

This statement is included for compatibility with MySQL. It has no effect on TiDB, which uses Prometheus and Grafana for centralized metrics collection instead of `SHOW STATUS`.
This statement is included for compatibility with MySQL. TiDB uses Prometheus and Grafana for centralized metrics collection instead of `SHOW STATUS` for most metrics.

## Synopsis

**ShowStmt:**

![ShowStmt](/media/sqlgram/ShowStmt.png)
A full description of the variables can be found here: [status variables](/status-variables.md)

**ShowTargetFilterable:**
## Synopsis

![ShowTargetFilterable](/media/sqlgram/ShowTargetFilterable.png)
```ebnf+diagram
ShowStatusStmt ::=
'SHOW' Scope? 'STATUS' ShowLikeOrWhere?

**GlobalScope:**
Scope ::=
( 'GLOBAL' | 'SESSION' )

![GlobalScope](/media/sqlgram/GlobalScope.png)
ShowLikeOrWhere ::=
"LIKE" SimpleExpr
| "WHERE" Expression
```

## Examples

```sql
mysql> show status;
+--------------------+--------------------------------------+
| Variable_name | Value |
+--------------------+--------------------------------------+
| Ssl_cipher_list | |
| server_id | 93e2e07d-6bb4-4a1b-90b7-e035fae154fe |
| ddl_schema_version | 141 |
| Ssl_verify_mode | 0 |
| Ssl_version | |
| Ssl_cipher | |
+--------------------+--------------------------------------+
6 rows in set (0.01 sec)

mysql> show global status;
+--------------------+--------------------------------------+
| Variable_name | Value |
+--------------------+--------------------------------------+
| Ssl_cipher | |
| Ssl_cipher_list | |
| Ssl_verify_mode | 0 |
| Ssl_version | |
| server_id | 93e2e07d-6bb4-4a1b-90b7-e035fae154fe |
| ddl_schema_version | 141 |
+--------------------+--------------------------------------+
6 rows in set (0.00 sec)
mysql> SHOW SESSION STATUS;
+-------------------------------+--------------------------------------+
| Variable_name | Value |
+-------------------------------+--------------------------------------+
| Ssl_cipher | |
| Ssl_cipher_list | |
| Ssl_server_not_after | |
| Ssl_server_not_before | |
| Ssl_verify_mode | 0 |
| Ssl_version | |
| Uptime | 1409 |
| ddl_schema_version | 116 |
| last_plan_binding_update_time | 0000-00-00 00:00:00 |
| server_id | 61160e73-ab80-40ff-8f33-27d55d475fd1 |
+-------------------------------+--------------------------------------+
10 rows in set (0.00 sec)

mysql> SHOW GLOBAL STATUS;
+-----------------------+--------------------------------------+
| Variable_name | Value |
+-----------------------+--------------------------------------+
| Ssl_cipher | |
| Ssl_cipher_list | |
| Ssl_server_not_after | |
| Ssl_server_not_before | |
| Ssl_verify_mode | 0 |
| Ssl_version | |
| Uptime | 1413 |
| ddl_schema_version | 116 |
| server_id | 61160e73-ab80-40ff-8f33-27d55d475fd1 |
+-----------------------+--------------------------------------+
9 rows in set (0.00 sec)
```

## MySQL compatibility

* This statement is included only for compatibility with MySQL.
* This statement is compatible with MySQL.

## See also

* [FLUSH STATUS](/sql-statements/sql-statement-flush-status.md)
* [Server Status Variables](/status-variables.md)
74 changes: 74 additions & 0 deletions status-variables.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
title: Server Status Variables
summary: Use status variables to see the system and session status
---

# Server Status Variables

Server status variables provide information about the global status of the server and the status of the current session in TiDB. Most of these variables are designed to be compatible with MySQL.

You can retrieve the global status using the [SHOW GLOBAL STATUS](/sql-statements/sql-statement-show-status.md) command, and the status of the current session using the [SHOW SESSION STATUS](/sql-statements/sql-statement-show-status.md) command.

Additionally, the [FLUSH STATUS](/sql-statements/sql-statement-flush-status.md) command is supported for MySQL compatibility.

## Variable reference

### Ssl_cipher

- Scope: SESSION | GLOBAL
- Type: String
- TLS Cipher that is in use.

### Ssl_cipher_list

- Scope: SESSION | GLOBAL
- Type: String
- The list of TLS Ciphers that the server supports.

### Ssl_server_not_after

- Scope: SESSION | GLOBAL
- Type: Date
- The expiration date of the X.509 certificate of the server that is used for TLS connections.

### Ssl_server_not_before

- Scope: SESSION | GLOBAL
- Type: String
- The start date of the X.509 certificate of the server that is used for TLS connections.

### Ssl_verify_mode

- Scope: SESSION | GLOBAL
- Type: Integer
- The TLS verification mode bitmask.

### Ssl_version

- Scope: SESSION | GLOBAL
- Type: String
- The version of the TLS protocol that is used

### Uptime

- Scope: SESSION | GLOBAL
- Type: Integer
- Uptime of the server in seconds.

### ddl_schema_version

- Scope: SESSION | GLOBAL
- Type: Integer
- The version of the DDL schema that is used.

### last_plan_binding_update_time <span class="version-mark">New in v5.2.0</span>

- Scope: SESSION
- Type: Timestamp
- The time and date of the last plan binding update.

### server_id

- Scope: SESSION | GLOBAL
- Type: String
- The UUID of the server.
2 changes: 1 addition & 1 deletion system-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Starting from v7.4.0, you can temporarily modify the value of some `SESSION` var

For more information about the `SET_VAR` hint, see [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value).

## Variable Reference
## Variable reference

### allow_auto_random_explicit_insert <span class="version-mark">New in v4.0.3</span>

Expand Down
Loading