Skip to content

Commit

Permalink
Update SHOW STATUS docs (#15363)
Browse files Browse the repository at this point in the history
  • Loading branch information
dveeden authored Dec 4, 2023
1 parent 83bf264 commit cd152a9
Show file tree
Hide file tree
Showing 6 changed files with 146 additions and 38 deletions.
1 change: 1 addition & 0 deletions TOC-tidb-cloud.md
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,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 @@ -645,6 +645,7 @@
- [Compatibility](/tiflash/tiflash-compatibility.md)
- [Pipeline Execution Model](/tiflash/tiflash-pipeline-model.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 @@ -74,8 +74,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)
85 changes: 49 additions & 36 deletions sql-statements/sql-statement-show-status.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,56 +6,69 @@ aliases: ['/docs/dev/sql-statements/sql-statement-show-status/','/docs/dev/refer

# 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 |
+-------------------------------+--------------------------------------+
| Compression | OFF |
| Compression_algorithm | |
| Compression_level | 0 |
| 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 |
+-------------------------------+--------------------------------------+
13 rows in set (0.00 sec)

sql> 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)
92 changes: 92 additions & 0 deletions status-variables.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
---
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

### Compression

- Scope: SESSION
- Type: Boolean
- Indicates if the MySQL Protocol uses compression or not.

### Compression_algorithm

- Scope: SESSION
- Type: String
- Indicates the compression algorithm that is used for the MySQL Protocol.

### Compression_level

- Scope: SESSION
- Type: Integer
- The compression level that is used for the MySQL Protocol.

### 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 @@ -50,7 +50,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

0 comments on commit cd152a9

Please sign in to comment.