You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: information-schema/information-schema-slow-query.md
+58Lines changed: 58 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -262,3 +262,61 @@ Currently, because statistics of the system tables are not collected, sometimes
262
262
```sql
263
263
SELECT/*+ AGG_TO_COP() */COUNT(*) FROM CLUSTER_SLOW_QUERY GROUP BY user;
264
264
```
265
+
266
+
## View execution information
267
+
268
+
By running an [`EXPLAIN ANALYZE`](/sql-statements/sql-statement-explain-analyze.md) query on the `SLOW_QUERY` table, you can get detailed information about how the database fetches the slow query information. However, this information is **not** available when you run `EXPLAIN ANALYZE` on the `CLUSTER_SLOW_QUERY` table.
operator info: only search in the current 'tidb-slow.log' file
295
+
memory: 1.26 MB
296
+
disk: N/A
297
+
2 rows in set (0.01 sec)
298
+
```
299
+
300
+
In the output, check the following fields (formatted for readability) in the `execution info` section:
301
+
302
+
```
303
+
initialize: 55.5µs,
304
+
read_file: 1.21ms,
305
+
parse_log: {
306
+
time:4.11ms,
307
+
concurrency:15
308
+
},
309
+
total_file: 1,
310
+
read_file: 1,
311
+
read_size: 4.06 MB
312
+
```
313
+
314
+
| Field | Description |
315
+
|---|---|
316
+
|`initialize`| Time spent initializing |
317
+
|`read_file`| Time spent reading the slow log file |
318
+
|`parse_log.time`| Time spent parsing the slow log file |
319
+
|`parse_log.concurrency`| Concurrency for parsing the slow log file (set by [`tidb_distsql_scan_concurrency`](/system-variables.md#tidb_distsql_scan_concurrency)) |
320
+
|`total_file`| Total number of slow log files |
321
+
|`read_file`| Number of slow log files that are read |
Copy file name to clipboardExpand all lines: system-variables.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1787,6 +1787,7 @@ mysql> SELECT job_info FROM mysql.analyze_jobs ORDER BY end_time DESC LIMIT 1;
1787
1787
- If a table has a lot of partitions, you can reduce the variable value appropriately (determined by the size of the data to be scanned and the frequency of the scan) to avoid TiKV becoming out of memory (OOM).
1788
1788
- For a simple query with only a `LIMIT` clause, if the `LIMIT` value is less than 100000, the scan operation pushed down to TiKV treats the value of this variable as`1` to enhance execution efficiency.
1789
1789
- For the `SELECT MAX/MIN(col) FROM ...` query, if the `col` column has an index sorted in the same order required by the `MAX(col)`or`MIN(col)` function, TiDB will rewrite the query to `SELECT col FROM ... LIMIT 1` for processing, and the value of this variable will also be processed as`1`. For example, for `SELECT MIN(col) FROM ...`, if the `col` column has an ascending index, TiDB can quickly obtain the `MIN(col)` value by rewriting the query to `SELECT col FROM ... LIMIT 1`and directly reading the first row of the index.
1790
+
- For queries on the [`SLOW_QUERY`](/information-schema/information-schema-slow-query.md) table, this variable controls the concurrency for parsing the slow log file.
0 commit comments