Skip to content

Commit

Permalink
Add/clarify SQL length limits (#15602) (#15806)
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-chi-bot authored Dec 20, 2023
1 parent 345119f commit 79d5fdd
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
4 changes: 4 additions & 0 deletions dashboard/dashboard-slow-query.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ Click any item in the list to display detailed execution information of the slow

### SQL

> **Note:**
>
> The maximum length of the query recorded in 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.
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
13 changes: 12 additions & 1 deletion system-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -4588,7 +4588,18 @@ 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">
- 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 the [TiDB Dashboard](/dashboard/dashboard-intro.md).
</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.
</CustomContent>
### tidb_stmt_summary_max_stmt_count <span class="version-mark">New in v4.0</span>
Expand Down

0 comments on commit 79d5fdd

Please sign in to comment.