From c4db209726312488796458ef1810d77ed391e8c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Fri, 25 Aug 2023 15:32:49 +0200 Subject: [PATCH 1/2] Document performance_schema.session_connect_attrs system table --- TOC-tidb-cloud.md | 3 + TOC.md | 3 + ...erformance-schema-session-connect-attrs.md | 65 +++++++++++++++++++ performance-schema/performance-schema.md | 50 ++++++++++++++ 4 files changed, 121 insertions(+) create mode 100644 performance-schema/performance-schema-session-connect-attrs.md create mode 100644 performance-schema/performance-schema.md diff --git a/TOC-tidb-cloud.md b/TOC-tidb-cloud.md index a802242270845..fac32ba6e0eaf 100644 --- a/TOC-tidb-cloud.md +++ b/TOC-tidb-cloud.md @@ -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) diff --git a/TOC.md b/TOC.md index 4b5a3881616be..0fa5139447409 100644 --- a/TOC.md +++ b/TOC.md @@ -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 diff --git a/performance-schema/performance-schema-session-connect-attrs.md b/performance-schema/performance-schema-session-connect-attrs.md new file mode 100644 index 0000000000000..0ef7564bd75e8 --- /dev/null +++ b/performance-schema/performance-schema-session-connect-attrs.md @@ -0,0 +1,65 @@ +--- +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 | + +{{< 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 | | ++------------------+---------------------+------+-----+---------+-------+ +``` + +{{< 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. diff --git a/performance-schema/performance-schema.md b/performance-schema/performance-schema.md new file mode 100644 index 0000000000000..3a3fa419010dc --- /dev/null +++ b/performance-schema/performance-schema.md @@ -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` | | From 01f970f8d16f33aa7bf4e34e16a3411c042873df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Mon, 28 Aug 2023 10:37:58 +0200 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Ran --- .../performance-schema-session-connect-attrs.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/performance-schema/performance-schema-session-connect-attrs.md b/performance-schema/performance-schema-session-connect-attrs.md index 0ef7564bd75e8..e1a758d7d2b33 100644 --- a/performance-schema/performance-schema-session-connect-attrs.md +++ b/performance-schema/performance-schema-session-connect-attrs.md @@ -5,7 +5,6 @@ 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: @@ -19,6 +18,8 @@ Common attributes: | `_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 @@ -37,6 +38,8 @@ DESCRIBE session_connect_attrs; +------------------+---------------------+------+-----+---------+-------+ ``` +You can view the information on session attributes stored in the `SESSION_CONNECT_ATTRS` table as follows: + {{< copyable "sql" >}} ```sql