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 cpu usage in hot region statistics and TIDB_HOT_REGIONS_HISTORY #8817

Open
nolouch opened this issue Nov 15, 2024 · 0 comments
Open

add cpu usage in hot region statistics and TIDB_HOT_REGIONS_HISTORY #8817

nolouch opened this issue Nov 15, 2024 · 0 comments
Labels
type/feature-request Categorizes issue or PR as related to a new feature.

Comments

@nolouch
Copy link
Contributor

nolouch commented Nov 15, 2024

Feature Request

Describe your feature request related problem

To retrieve the top N tables ranked by QUERY_RATE in a query, you can use ORDER BY to sort by QUERY_RATE and combine it with LIMIT to restrict the number of records returned. Here is the revised SQL query:

SELECT DB_NAME, TABLE_NAME, AVG(QUERY_RATE) AS QUERY_RATE
FROM INFORMATION_SCHEMA.TIDB_HOT_REGIONS_HISTORY
WHERE update_time > DATE_SUB(NOW(), INTERVAL 30 MINUTE)
  AND update_time <= NOW()
  AND `STORE_ID` = "1249"
GROUP BY TABLE_NAME, DB_NAME
ORDER BY QUERY_RATE DESC
LIMIT 10; 


+-----------------------+------------+--------------------+
| DB_NAME               | TABLE_NAME | QUERY_RATE         |
+-----------------------+------------+--------------------+
| RG_SBTEST_32_10000000 | SBTEST1    | 26307.666666666668 |
+-----------------------+------------+--------------------+

Describe the feature you'd like

But I want to know the CPU usage like

+-----------------------+------------+--------------------+---------+
| DB_NAME               | TABLE_NAME | QUERY_RATE         |. CPU
+-----------------------+------------+--------------------+-----------+
| RG_SBTEST_32_10000000 | SBTEST1    | 26307.666666666668 |NAN|
+-----------------------+------------+--------------------+-----------+

actually, we can know the CPU usage after #4042

@nolouch nolouch added the type/feature-request Categorizes issue or PR as related to a new feature. label Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/feature-request Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

No branches or pull requests

1 participant