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

Document performance_schema.session_connect_attrs system table (#14616) #14749

Merged
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions TOC-tidb-cloud.md
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,9 @@
- [`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)
- PERFORMANCE_SCHEMA
- [Overview](/performance-schema/performance-schema.md)
- [`SESSION_CONNECT_ATTRS`](/performance-schema/performance-schema-session-connect-attrs.md)
- [Metadata Lock](/metadata-lock.md)
- [Use UUIDs](/best-practices/uuid.md)
- [System Variables](/system-variables.md)
Expand Down
3 changes: 3 additions & 0 deletions TOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,9 @@
- [`VARIABLES_INFO`](/information-schema/information-schema-variables-info.md)
- [`VIEWS`](/information-schema/information-schema-views.md)
- [`METRICS_SCHEMA`](/metrics-schema.md)
- PERFORMANCE_SCHEMA
- [Overview](/performance-schema/performance-schema.md)
- [`SESSION_CONNECT_ATTRS`](/performance-schema/performance-schema-session-connect-attrs.md)
- [Metadata Lock](/metadata-lock.md)
- UI
- TiDB Dashboard
Expand Down
68 changes: 68 additions & 0 deletions performance-schema/performance-schema-session-connect-attrs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
title: SESSION_CONNECT_ATTRS
summary: Learn the `SESSION_CONNECT_ATTRS` performance_schema table.
---

# SESSION\_CONNECT\_ATTRS

The `SESSION_CONNECT_ATTRS` table provides information about connection attributes. Session attributes are key-value pairs that are sent by the client when establishing a connection.

Common attributes:

| Attribute Name | Example | Description |
|-------------------|---------------|----------------------------|
| `_client_name` | `libmysql` | Client library name |
| `_client_version` | `8.0.33` | Client library version |
| `_os` | `Linux` | Operating System |
| `_pid` | `712927` | Process ID |
| `_platform` | `x86_64` | CPU Architecture |
| `program_name` | `mysqlsh` | Program name |

You can view the columns of the `SESSION_CONNECT_ATTRS` table as follows:

{{< copyable "sql" >}}

```sql
USE performance_schema;
DESCRIBE session_connect_attrs;
```

```
+------------------+---------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------------+---------------------+------+-----+---------+-------+
| PROCESSLIST_ID | bigint(20) unsigned | NO | | NULL | |
| ATTR_NAME | varchar(32) | NO | | NULL | |
| ATTR_VALUE | varchar(1024) | YES | | NULL | |
| ORDINAL_POSITION | int(11) | YES | | NULL | |
+------------------+---------------------+------+-----+---------+-------+
```

You can view the information on session attributes stored in the `SESSION_CONNECT_ATTRS` table as follows:

{{< copyable "sql" >}}

```sql
USE performance_schema;
TABLE SESSION_CONNECT_ATTRS;
```

```
+----------------+-----------------+------------+------------------+
| PROCESSLIST_ID | ATTR_NAME | ATTR_VALUE | ORDINAL_POSITION |
+----------------+-----------------+------------+------------------+
| 2097154 | _client_name | libmysql | 0 |
| 2097154 | _client_version | 8.1.0 | 1 |
| 2097154 | _os | Linux | 2 |
| 2097154 | _pid | 1299203 | 3 |
| 2097154 | _platform | x86_64 | 4 |
| 2097154 | program_name | mysqlsh | 5 |
+----------------+-----------------+------------+------------------+
```

Fields in the `SESSION_CONNECT_ATTRS` table are described as follows:

* `PROCESSLIST_ID`: Processlist ID of the session.
* `ATTR_NAME`: Attribute name.
* `ATTR_VALUE`: Attribute value.
* `ORDINAL_POSITION`: Ordinal position of the name/value pair.
50 changes: 50 additions & 0 deletions performance-schema/performance-schema.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
title: Performance Schema
summary: TiDB implements the performance_schema for viewing system metadata.
---

# Performance Schema

TiDB implements performance schema tables for MySQL compatibility.

## Tables for MySQL compatibility

| Table Name | Description |
|--------------------------------------------------------------------------------------------------|-----------------------------------------------------------|
| `events_stages_current` | |
| `events_stages_history` | |
| `events_stages_history_long` | |
| `events_statements_current` | |
| `events_statements_history` | |
| `events_statements_history_long` | |
| `events_statements_summary_by_digest` | |
| `events_transactions_current` | |
| `events_transactions_history` | |
| `events_transactions_history_long` | |
| `global_status` | |
| `prepared_statements_instances` | |
| [`session_connect_attrs`](/performance-schema/performance-schema-session-connect-attrs.md) | Provides connection attributes for sessions. |
| `session_status` | |
| `session_variables` | |
| `setup_actors` | |
| `setup_consumers` | |
| `setup_instruments` | |
| `setup_objects` | |

## Tables that are TiDB extensions

| Table Name | Description |
|--------------------------------------------------------------------------------------------------|-----------------------------------------------------------|
| `pd_profile_allocs` | |
| `pd_profile_block` | |
| `pd_profile_cpu` | |
| `pd_profile_goroutines` | |
| `pd_profile_memory` | |
| `pd_profile_mutex` | |
| `tidb_profile_allocs` | |
| `tidb_profile_block` | |
| `tidb_profile_cpu` | |
| `tidb_profile_goroutines` | |
| `tidb_profile_memory` | |
| `tidb_profile_mutex` | |
| `tikv_profile_cpu` | |