Skip to content

Commit 305c083

Browse files
authored
Document performance_schema.session_connect_attrs system table (#15449)
1 parent 9a1a24e commit 305c083

File tree

3 files changed

+118
-1
lines changed

3 files changed

+118
-1
lines changed

TOC.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@
916916
- 系统表
917917
- [`mysql`](/mysql-schema.md)
918918
- INFORMATION_SCHEMA
919-
- [Overview](/information-schema/information-schema.md)
919+
- [概述](/information-schema/information-schema.md)
920920
- [`ANALYZE_STATUS`](/information-schema/information-schema-analyze-status.md)
921921
- [`CHECK_CONSTRAINTS`](/information-schema/information-schema-check-constraints.md)
922922
- [`CLIENT_ERRORS_SUMMARY_BY_HOST`](/information-schema/client-errors-summary-by-host.md)
@@ -974,6 +974,9 @@
974974
- [`VARIABLES_INFO`](/information-schema/information-schema-variables-info.md)
975975
- [`VIEWS`](/information-schema/information-schema-views.md)
976976
- [`METRICS_SCHEMA`](/metrics-schema.md)
977+
- PERFORMANCE_SCHEMA
978+
- [概述](/performance-schema/performance-schema.md)
979+
- [`SESSION_CONNECT_ATTRS`](/performance-schema/performance-schema-session-connect-attrs.md)
977980
- [元数据锁](/metadata-lock.md)
978981
- UI
979982
- TiDB Dashboard
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
title: SESSION_CONNECT_ATTRS
3+
summary: 了解 performance_schema 表 `SESSION_CONNECT_ATTRS`。
4+
---
5+
6+
# SESSION\_CONNECT\_ATTRS
7+
8+
`SESSION_CONNECT_ATTRS` 表提供了关于连接属性的信息。会话属性是在建立连接时由客户端发送的键值对。
9+
10+
常见属性:
11+
12+
| 属性名 | 示例 | 描述 |
13+
|-------|-----|------|
14+
| `_client_name` | `libmysql` | 客户端库名 |
15+
| `_client_version` | `8.0.33` | 客户端库版本|
16+
| `_os` | `Linux` | 操作系统 |
17+
| `_pid` | `712927` | 进程 ID |
18+
| `_platform` | `x86_64` | CPU 架构 |
19+
| `program_name` | `mysqlsh` | 程序名 |
20+
21+
你可以通过以下方式查看 `SESSION_CONNECT_ATTRS` 表的列信息:
22+
23+
```sql
24+
USE performance_schema;
25+
DESCRIBE session_connect_attrs;
26+
```
27+
28+
```
29+
+------------------+---------------------+------+-----+---------+-------+
30+
| Field | Type | Null | Key | Default | Extra |
31+
+------------------+---------------------+------+-----+---------+-------+
32+
| PROCESSLIST_ID | bigint(20) unsigned | NO | | NULL | |
33+
| ATTR_NAME | varchar(32) | NO | | NULL | |
34+
| ATTR_VALUE | varchar(1024) | YES | | NULL | |
35+
| ORDINAL_POSITION | int(11) | YES | | NULL | |
36+
+------------------+---------------------+------+-----+---------+-------+
37+
```
38+
39+
你可以通过以下方式查看 `SESSION_CONNECT_ATTRS` 表中存储的会话属性信息:
40+
41+
```sql
42+
USE performance_schema;
43+
TABLE SESSION_CONNECT_ATTRS;
44+
```
45+
46+
```
47+
+----------------+-----------------+------------+------------------+
48+
| PROCESSLIST_ID | ATTR_NAME | ATTR_VALUE | ORDINAL_POSITION |
49+
+----------------+-----------------+------------+------------------+
50+
| 2097154 | _client_name | libmysql | 0 |
51+
| 2097154 | _client_version | 8.1.0 | 1 |
52+
| 2097154 | _os | Linux | 2 |
53+
| 2097154 | _pid | 1299203 | 3 |
54+
| 2097154 | _platform | x86_64 | 4 |
55+
| 2097154 | program_name | mysqlsh | 5 |
56+
+----------------+-----------------+------------+------------------+
57+
```
58+
59+
`SESSION_CONNECT_ATTRS` 表的字段描述如下:
60+
61+
* `PROCESSLIST_ID`:会话的 Processlist ID。
62+
* `ATTR_NAME`:属性名。
63+
* `ATTR_VALUE`:属性值。
64+
* `ORDINAL_POSITION`:属性名/属性值对的序号。
+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
title: Performance Schema
3+
summary: 了解 TiDB `performance_schema` 系统数据库。
4+
---
5+
6+
# Performance Schema
7+
8+
TiDB 实现了兼容 MySQL 的 performance schema 表。
9+
10+
## 与 MySQL 兼容的表
11+
12+
| 表名| 描述 |
13+
| --- | --- |
14+
| `events_stages_current` | |
15+
| `events_stages_history`| |
16+
| `events_stages_history_long` | |
17+
| `events_statements_current` | |
18+
| `events_statements_history` | |
19+
| `events_statements_history_long` | |
20+
| `events_statements_summary_by_digest` | |
21+
| `events_transactions_current` | |
22+
| `events_transactions_history` | |
23+
| `events_transactions_history_long` | |
24+
| `global_status` | |
25+
| `prepared_statements_instances` | |
26+
| [`session_connect_attrs`](/performance-schema/performance-schema-session-connect-attrs.md) | 为会话提供连接属性。 |
27+
| `session_status` | |
28+
| `session_variables` | |
29+
| `setup_actors` | |
30+
| `setup_consumers` | |
31+
| `setup_instruments`| |
32+
| `setup_objects` | |
33+
34+
## TiDB 中的扩展表
35+
36+
| 表名 | 描述 |
37+
| ------------------------- | ----------- |
38+
| `pd_profile_allocs` | |
39+
| `pd_profile_block` | |
40+
| `pd_profile_cpu` | |
41+
| `pd_profile_goroutines`| |
42+
| `pd_profile_memory` | |
43+
| `pd_profile_mutex` | |
44+
| `tidb_profile_allocs` | |
45+
| `tidb_profile_block`| |
46+
| `tidb_profile_cpu` | |
47+
| `tidb_profile_goroutines` | |
48+
| `tidb_profile_memory` | |
49+
| `tidb_profile_mutex`| |
50+
| `tikv_profile_cpu` | |

0 commit comments

Comments
 (0)