tikv / tikv/pd

add cpu usage in hot region statistics and TIDB_HOT_REGIONS_HISTORY

Open
#8,817 0 comments 0 reactions 0 assignees View on GitHub
type/feature-request
Dominant language
Go
Stars
1.2k
Forks
783
Avg merge
5d 21h
Merged PRs (30d)
36

Description

## 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 https://github.com/tikv/pd/issues/4042

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.