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

RuntimeStats for cluster_slow_query #56707

Open
dveeden opened this issue Oct 17, 2024 · 1 comment
Open

RuntimeStats for cluster_slow_query #56707

dveeden opened this issue Oct 17, 2024 · 1 comment
Labels
component/executor sig/execution SIG execution type/feature-request Categorizes issue or PR as related to a new feature.

Comments

@dveeden
Copy link
Contributor

dveeden commented Oct 17, 2024

In #20200 stats were added for the information_schema.slow_query table. However there is nothing for the similar information_schema.cluster_slow_query table.

Example:

mysql-8.0.11-TiDB-v8.4.0-alpha-364-gd5796776c1-dirty> EXPLAIN ANALYZE SELECT * FROM information_schema.slow_query LIMIT 1;
+-----------------------+----------+---------+------+------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------+---------+------+
| id                    | estRows  | actRows | task | access object    | execution info                                                                                                                                          | operator info                                   | memory  | disk |
+-----------------------+----------+---------+------+------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------+---------+------+
| Limit_7               | 1.00     | 1       | root |                  | time:1.94ms, loops:2, RU:0.000000                                                                                                                       | offset:0, count:1                               | N/A     | N/A  |
| └─MemTableScan_10     | 10000.00 | 64      | root | table:SLOW_QUERY | time:1.93ms, loops:1, initialize: 25.8µs, read_file: 912µs, parse_log: {time:1.78ms, concurrency:15}, total_file: 1, read_file: 1, read_size: 4.05 MB   | only search in the current 'tidb-slow.log' file | 1.25 MB | N/A  |
+-----------------------+----------+---------+------+------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------+---------+------+
2 rows in set (0.00 sec)

mysql-8.0.11-TiDB-v8.4.0-alpha-364-gd5796776c1-dirty> EXPLAIN ANALYZE SELECT * FROM information_schema.cluster_slow_query LIMIT 1;
+---------------------------+---------+---------+-----------+--------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------+---------+------+
| id                        | estRows | actRows | task      | access object            | execution info                                                                                                                                                            | operator info     | memory  | disk |
+---------------------------+---------+---------+-----------+--------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------+---------+------+
| Limit_7                   | 1.00    | 1       | root      |                          | time:2.89ms, loops:2, RU:0.515024                                                                                                                                         | offset:0, count:1 | N/A     | N/A  |
| └─TableReader_12          | 1.00    | 1       | root      |                          | time:2.89ms, loops:1, cop_task: {num: 1, max: 2.8ms, proc_keys: 0, copr_cache_hit_ratio: 0.00, max_distsql_concurrency: 1}, rpc_info:{Cop:{num_rpc:1, total_time:2.75ms}} | data:Limit_11     | 2.70 KB | N/A  |
|   └─Limit_11              | 1.00    | 0       | cop[tidb] |                          |                                                                                                                                                                           | offset:0, count:1 | N/A     | N/A  |
|     └─MemTableScan_10     | 1.00    | 0       | cop[tidb] | table:CLUSTER_SLOW_QUERY |                                                                                                                                                                           |                   | N/A     | N/A  |
+---------------------------+---------+---------+-----------+--------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------+---------+------+
4 rows in set (0.00 sec)

Note the initialize: 25.8µs, read_file: 912µs, parse_log: {time:1.78ms, concurrency:15}, total_file: 1, read_file: 1, read_size: 4.05 MB

This is generated here:

return fmt.Sprintf("initialize: %s, read_file: %s, parse_log: {time:%s, concurrency:%v}, total_file: %v, read_file: %v, read_size: %s",

For the cluster_slow_query table you can see that there are no stats:

func (*clusterLogRetriever) getRuntimeStats() execdetails.RuntimeStats {
return nil
}

What the stats could show:

  • Number of files read
  • Number of nodes involved
  • CPU usage
  • Time
  • Memory usage
  • Read bytes
  • Read number of entries
  • Concurrency

Most of these could be per-node, in total or both.

@dveeden dveeden added type/feature-request Categorizes issue or PR as related to a new feature. sig/execution SIG execution component/executor labels Oct 17, 2024
@dveeden
Copy link
Contributor Author

dveeden commented Oct 18, 2024

This could help with cases like this: #54522

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/executor sig/execution SIG execution type/feature-request Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

No branches or pull requests

1 participant