Skip to content

Commit

Permalink
Update SHOW STATUS docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dveeden committed Nov 16, 2023
1 parent f6235cd commit 9aa3a70
Show file tree
Hide file tree
Showing 5 changed files with 141 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 @@ -643,6 +643,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)
83 changes: 46 additions & 37 deletions sql-statements/sql-statement-show-status.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,56 +6,65 @@ 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:**

![ShowTargetFilterable](/media/sqlgram/ShowTargetFilterable.png)
## Synopsis

**GlobalScope:**
```ebnf+diagram
ShowStatusStmt ::=
'SHOW' GlobalScope STATUS
![GlobalScope](/media/sqlgram/GlobalScope.png)
GlobalScope ::=
( 'GLOBAL' | 'SESSION' )?
```

## 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)
91 changes: 91 additions & 0 deletions status-variables.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
title: Server Status Variables
summary: Use status variables to see the system and session status
---

# Server Status Variables

Most status variables are implemented to be compatible with MySQL. These variables give information about the global status of the server and the status of the current session.

The [SHOW GLOBAL STATUS](/sql-statements/sql-statement-show-status.md) command can be used to retrieve the global status and the [SHOW SESSION STATUS](/sql-statements/sql-statement-show-status.md) command can be used to see the status of the current session.

The [FLUSH STATUS](/sql-statements/sql-statement-flush-status.md) command is also support to aid 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 | GLOBAL
- 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: String

### 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 | GLOBAL
- Type: Timestamp
- The time and date of the last plan binding update.

### server_id

- Scope: SESSION | GLOBAL
- Type: String
- UUID of the server

0 comments on commit 9aa3a70

Please sign in to comment.