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

Add/clarify SQL length limits #15602

Merged
merged 8 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions dashboard/dashboard-slow-query.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ Click any item in the list to display detailed execution information of the slow

### SQL

> **Note:**
>
> The maximum length of the query is limited by the [`tidb_stmt_summary_max_sql_length`](/system-variables.md#tidb_stmt_summary_max_sql_length-new-in-v40) system variable.
dveeden marked this conversation as resolved.
Show resolved Hide resolved

Click the **Expand** button to view the detailed information of an item. Click the **Copy** button to copy the detailed information to the clipboard.

### Execution plans
Expand Down
8 changes: 5 additions & 3 deletions information-schema/information-schema-slow-query.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ The output is as follows:
74 rows in set (0.001 sec)
```

The maximum statement length of the `Query` column is limited by the [`tidb_stmt_summary_max_sql_length`](/system-variables.md#tidb_stmt_summary_max_sql_length-new-in-v40) system variable.

## CLUSTER_SLOW_QUERY table

The `CLUSTER_SLOW_QUERY` table provides the slow query information of all nodes in the cluster, which is the parsing result of the TiDB slow log files. You can use the `CLUSTER_SLOW_QUERY` table the way you do with `SLOW_QUERY`. The table schema of the `CLUSTER_SLOW_QUERY` table differs from that of the `SLOW_QUERY` table in that an `INSTANCE` column is added to `CLUSTER_SLOW_QUERY`. The `INSTANCE` column represents the TiDB node address of the row information on the slow query.
Expand Down Expand Up @@ -222,9 +224,9 @@ The output is as follows:
| id | estRows | task | access object | operator info |
+----------------------------+----------+-----------+--------------------------+------------------------------------------------------+
| StreamAgg_7 | 1.00 | root | | funcs:count(1)->Column#75 |
| └─TableReader_13 | 10.00 | root | | data:Selection_12 |
| └─Selection_12 | 10.00 | cop[tidb] | | eq(INFORMATION_SCHEMA.cluster_slow_query.user, "u1") |
| └─TableFullScan_11 | 10000.00 | cop[tidb] | table:CLUSTER_SLOW_QUERY | keep order:false, stats:pseudo |
| └─TableReader_13 | 10.00 | root | | data:Selection_12 |
| └─Selection_12 | 10.00 | cop[tidb] | | eq(INFORMATION_SCHEMA.cluster_slow_query.user, "u1") |
| └─TableFullScan_11 | 10000.00 | cop[tidb] | table:CLUSTER_SLOW_QUERY | keep order:false, stats:pseudo |
+----------------------------+----------+-----------+--------------------------+------------------------------------------------------+
4 rows in set (0.00 sec)
```
Expand Down
9 changes: 8 additions & 1 deletion system-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -5230,7 +5230,14 @@ For details, see [Identify Slow Queries](/identify-slow-queries.md).
- Type: Integer
- Default value: `4096`
- Range: `[0, 2147483647]`
- This variable is used to control the length of the SQL string in [statement summary tables](/statement-summary-tables.md).

<CustomContent platform="tidb">
dveeden marked this conversation as resolved.
Show resolved Hide resolved
- This variable is used to control the length of the SQL string in [statement summary tables](/statement-summary-tables.md), the [SLOW_QUERY](/information-schema/information-schema-slow-query.md) table and on the [TiDB Dashboard](/dashboard/dashboard-intro.md).
hfxsd marked this conversation as resolved.
Show resolved Hide resolved
dveeden marked this conversation as resolved.
Show resolved Hide resolved
</CustomContent>

<CustomContent platform="tidb-cloud">
- This variable is used to control the length of the SQL string in [statement summary tables](/statement-summary-tables.md) and the [SLOW_QUERY](/information-schema/information-schema-slow-query.md) table.
dveeden marked this conversation as resolved.
Show resolved Hide resolved
</CustomContent>
dveeden marked this conversation as resolved.
Show resolved Hide resolved

### tidb_stmt_summary_max_stmt_count <span class="version-mark">New in v4.0</span>

Expand Down
Loading