-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: adds region_statistics refernece
- Loading branch information
1 parent
34cd39f
commit 8c22968
Showing
7 changed files
with
138 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
docs/reference/sql/information-schema/region-statistics.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# REGION_STATISTICS | ||
|
||
The `REGION_STATISTICS` table provides detailed information about a region's statistics, including the total number of rows, disk size, and more. These statistics are approximate values. | ||
|
||
:::tip NOTE | ||
This table is not available on [GreptimeCloud](https://greptime.cloud/). | ||
::: | ||
|
||
```sql | ||
USE INFORMATION_SCHEMA; | ||
DESC REGION_STATISTICS; | ||
``` | ||
|
||
The output is as follows: | ||
|
||
```sql | ||
+---------------+--------+------+------+---------+---------------+ | ||
| Column | Type | Key | Null | Default | Semantic Type | | ||
+---------------+--------+------+------+---------+---------------+ | ||
| region_id | UInt64 | | NO | | FIELD | | ||
| table_id | UInt32 | | NO | | FIELD | | ||
| region_number | UInt32 | | NO | | FIELD | | ||
| region_rows | UInt64 | | YES | | FIELD | | ||
| disk_size | UInt64 | | YES | | FIELD | | ||
| memtable_size | UInt64 | | YES | | FIELD | | ||
| manifest_size | UInt64 | | YES | | FIELD | | ||
| sst_size | UInt64 | | YES | | FIELD | | ||
| index_size | UInt64 | | YES | | FIELD | | ||
| engine | String | | YES | | FIELD | | ||
| region_role | String | | YES | | FIELD | | ||
+---------------+--------+------+------+---------+---------------+ | ||
``` | ||
|
||
Fields in the `REGION_STATISTICS` table are described as follows: | ||
|
||
- `region_id`: The ID of the Region. | ||
- `table_id`: The ID of the table. | ||
- `region_number`: The number of the region in the table. | ||
- `region_rows`: The number of rows in the region. | ||
- `disk_size`: The total size of data files in the region, including data, index and metadata etc. | ||
- `memtable_size`: The region's total size of memtables. | ||
- `manifest_size`: The region's total size of manifest files. | ||
- `sst_size`: The region's total size of SST files. | ||
- `index_size`: The region's total size of index files. | ||
- `engine`: The engine type of the region, `mito` or `metric`. | ||
- `region_role`: The region's role, `Leader` or `Follower`. | ||
|
||
|
||
Retrieve a table's region statistics information as follows: | ||
|
||
```sql | ||
SELECT r.* FROM REGION_STATISTICS r LEFT JOIN TABLES t on r.table_id = t.table_id WHERE t.table_name = 'system_metrics'; | ||
``` | ||
|
||
|
||
Output: | ||
```sql | ||
+---------------+----------+---------------+-------------+-----------+---------------+---------------+----------+------------+--------+-------------+ | ||
| region_id | table_id | region_number | region_rows | disk_size | memtable_size | manifest_size | sst_size | index_size | engine | region_role | | ||
+---------------+----------+---------------+-------------+-----------+---------------+---------------+----------+------------+--------+-------------+ | ||
| 4398046511104 | 1024 | 0 | 8 | 4922 | 0 | 1338 | 3249 | 335 | mito | Leader | | ||
+---------------+----------+---------------+-------------+-----------+---------------+---------------+----------+------------+--------+-------------+ | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
...ugin-content-docs/current/reference/sql/information-schema/region-statistics.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# REGION_STATISTICS | ||
|
||
`REGION_STATISTICS` 表提供了关于某个 Region 统计信息的详细数据,包括总行数、磁盘大小等。这些统计信息都是近似值。 | ||
|
||
:::tip NOTE | ||
此表在 [GreptimeCloud](https://greptime.cloud/) 中不可用。 | ||
::: | ||
|
||
```sql | ||
USE INFORMATION_SCHEMA; | ||
DESC REGION_STATISTICS; | ||
``` | ||
|
||
输出如下: | ||
|
||
```sql | ||
+---------------+--------+------+------+---------+---------------+ | ||
| Column | Type | Key | Null | Default | Semantic Type | | ||
+---------------+--------+------+------+---------+---------------+ | ||
| region_id | UInt64 | | NO | | FIELD | | ||
| table_id | UInt32 | | NO | | FIELD | | ||
| region_number | UInt32 | | NO | | FIELD | | ||
| region_rows | UInt64 | | YES | | FIELD | | ||
| disk_size | UInt64 | | YES | | FIELD | | ||
| memtable_size | UInt64 | | YES | | FIELD | | ||
| manifest_size | UInt64 | | YES | | FIELD | | ||
| sst_size | UInt64 | | YES | | FIELD | | ||
| index_size | UInt64 | | YES | | FIELD | | ||
| engine | String | | YES | | FIELD | | ||
| region_role | String | | YES | | FIELD | | ||
+---------------+--------+------+------+---------+---------------+ | ||
``` | ||
|
||
`REGION_STATISTICS` 表中的字段描述如下: | ||
|
||
- `region_id`: Region 的 ID。 | ||
- `table_id`: 表的 ID。 | ||
- `region_number`: Region 在表中的编号。 | ||
- `region_rows`: Region 中的记录行数。 | ||
- `disk_size`: Region 中数据文件的总大小,包括数据、索引及元信息等。 | ||
- `memtable_size`: Region 中内存 memtables 的总大小。 | ||
- `manifest_size`: Region 中元信息 manifest 文件的总大小。 | ||
- `sst_size`: Region 中 SST 文件的总大小。 | ||
- `index_size`: Region 中索引文件的总大小。 | ||
- `engine`: Region 的引擎类型,可以是 `mito` 或 `metric`。 | ||
- `region_role`: Region 的角色,可以是 `Leader` 或 `Follower`。 | ||
|
||
获取某张表的 Region 统计信息如下: | ||
|
||
```sql | ||
SELECT r.* FROM REGION_STATISTICS r LEFT JOIN TABLES t on r.table_id = t.table_id WHERE t.table_name = 'system_metrics'; | ||
``` | ||
|
||
输出: | ||
```sql | ||
+---------------+----------+---------------+-------------+-----------+---------------+---------------+----------+------------+--------+-------------+ | ||
| region_id | table_id | region_number | region_rows | disk_size | memtable_size | manifest_size | sst_size | index_size | engine | region_role | | ||
+---------------+----------+---------------+-------------+-----------+---------------+---------------+----------+------------+--------+-------------+ | ||
| 4398046511104 | 1024 | 0 | 8 | 4922 | 0 | 1338 | 3249 | 335 | mito | Leader | | ||
+---------------+----------+---------------+-------------+-----------+---------------+---------------+----------+------------+--------+-------------+ | ||
``` | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters