Skip to content

Commit 85c8362

Browse files
committed
add table_disk_usage from 2091
1 parent 1a24c74 commit 85c8362

16 files changed

Lines changed: 1018 additions & 16 deletions

src/UserGuide/Master/Table/Reference/System-Tables_apache.md

Lines changed: 77 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ IoTDB> show tables from information_schema
5959
| regions| INF|
6060
| services| INF|
6161
| subscriptions| INF|
62+
| table_disk_usage| INF|
6263
| tables| INF|
6364
| topics| INF|
6465
| views| INF|
@@ -67,7 +68,7 @@ IoTDB> show tables from information_schema
6768

6869
## 2. System Tables
6970

70-
***Names**​: `DATABASES`, `TABLES`, `REGIONS`, `QUERIES`, `COLUMNS`, `PIPES`, `PIPE_PLUGINS`, `SUBSCRIPTION`, `TOPICS`, `VIEWS`, `MODELS`, `FUNCTIONS`, `CONFIGURATIONS`, `KEYWORDS`, `NODES`, `CONFIG_NODES`, `DATA_NODES` , `CONNECTIONS`, `CURRENT_QUERIES`, `QUERIES_COSTS_HISTOGRAM`, `SERVICES` (detailed descriptions in later sections)
71+
***Names**​: `DATABASES`, `TABLES`, `REGIONS`, `QUERIES`, `COLUMNS`, `PIPES`, `PIPE_PLUGINS`, `SUBSCRIPTION`, `TOPICS`, `VIEWS`, `MODELS`, `FUNCTIONS`, `CONFIGURATIONS`, `KEYWORDS`, `NODES`, `CONFIG_NODES`, `DATA_NODES` , `CONNECTIONS`, `CURRENT_QUERIES`, `QUERIES_COSTS_HISTOGRAM`, `SERVICES`, `TABLE_DISK_USAGE` (detailed descriptions in later sections)
7172
***Operations**​: Read-only, only supports `SELECT`, `COUNT/SHOW DEVICES`, `DESC`. Any modifications to table structure or content are not allowed and will result in an error: `"The database 'information_schema' can only be queried." `
7273
***Column Names**​: System table column names are all lowercase by default and separated by underscores (`_`).
7374

@@ -713,6 +714,81 @@ IoTDB> SELECT * FROM information_schema.services
713714
+------------+-----------+---------+
714715
```
715716

717+
##### 2.22 TABLE_DISK_USAGE
718+
> This system table is available since version V2.0.9-beta
719+
720+
Used to display the disk space usage of specified tables (excluding views), including the size of ChunkGroups and the size of Metadata.
721+
722+
Note: Statistics are based on the actual size of data in TsFiles; therefore, deletions made via mods are not considered.
723+
724+
The table structure is shown below:
725+
726+
| Column Name | Data Type | Column Type | Description |
727+
|-----------------|-----------|-------------|----------------------------------|
728+
| database | string | Field | Database name |
729+
| table_name | string | Field | Table name |
730+
| datanode_id | int32 | Field | DataNode node ID |
731+
| region_id | int32 | Field | Region ID |
732+
| time_partition | int64 | Field | Time partition ID |
733+
| size_in_bytes | int64 | Field | Disk space occupied (in bytes) |
734+
735+
**Query Examples**:
736+
737+
```SQL
738+
-- Query all data;
739+
select * from information_schema.table_disk_usage;
740+
```
741+
742+
```Bash
743+
+---------+-------------------+-----------+---------+--------------+-------------+
744+
| database| table_name|datanode_id|region_id|time_partition|size_in_bytes|
745+
+---------+-------------------+-----------+---------+--------------+-------------+
746+
|database1| table1| 1| 3| 2864| 867|
747+
|database1| table11| 1| 3| 2864| 0|
748+
|database1| table3| 1| 3| 2864| 0|
749+
|database1| table1| 1| 3| 2865| 1411|
750+
|database1| table11| 1| 3| 2865| 0|
751+
|database1| table3| 1| 3| 2865| 0|
752+
|database1| table1| 1| 3| 2925| 590|
753+
|database1| table11| 1| 3| 2925| 0|
754+
|database1| table3| 1| 3| 2925| 0|
755+
|database1| table1| 1| 4| 2864| 883|
756+
|database1| table11| 1| 4| 2864| 0|
757+
|database1| table3| 1| 4| 2864| 0|
758+
|database1| table1| 1| 4| 2865| 1224|
759+
|database1| table11| 1| 4| 2865| 0|
760+
|database1| table3| 1| 4| 2865| 0|
761+
|database1| table1| 1| 4| 2888| 0|
762+
|database1| table11| 1| 4| 2888| 0|
763+
|database1| table3| 1| 4| 2888| 205|
764+
| etth| tab_cov_forecast| 1| 8| 0| 0|
765+
| etth| tab_real| 1| 8| 0| 963|
766+
| etth|tab_target_forecast| 1| 8| 0| 0|
767+
| etth| tab_cov_forecast| 1| 9| 0| 448|
768+
| etth| tab_real| 1| 9| 0| 0|
769+
| etth|tab_target_forecast| 1| 9| 0| 0|
770+
+---------+-------------------+-----------+---------+--------------+-------------+
771+
```
772+
773+
```SQL
774+
-- Specify query conditions;
775+
select * from information_schema.table_disk_usage where region_id = 4 and table_name like '%1';
776+
```
777+
778+
```Bash
779+
+---------+----------+-----------+---------+--------------+-------------+
780+
| database|table_name|datanode_id|region_id|time_partition|size_in_bytes|
781+
+---------+----------+-----------+---------+--------------+-------------+
782+
|database1| table1| 1| 4| 2864| 883|
783+
|database1| table11| 1| 4| 2864| 0|
784+
|database1| table1| 1| 4| 2865| 1224|
785+
|database1| table11| 1| 4| 2865| 0|
786+
|database1| table1| 1| 4| 2888| 0|
787+
|database1| table11| 1| 4| 2888| 0|
788+
+---------+----------+-----------+---------+--------------+-------------+
789+
```
790+
791+
716792
## 3. Permission Description
717793

718794
* GRANT/REVOKE operations are not supported for the `information_schema` database or any of its tables.

src/UserGuide/Master/Table/Reference/System-Tables_timecho.md

Lines changed: 78 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323

2424
IoTDB has a built-in system database called `INFORMATION_SCHEMA`, which contains a series of system tables for storing IoTDB runtime information (such as currently executing SQL statements, etc.). Currently, the `INFORMATION_SCHEMA` database only supports read operations.
2525

26-
> 💡 **[V2.0.8.2 Version Update]**<br>
27-
> 👉 Added onw system tables: **[SERVICES](#_2-21-services)** (service status management), enhancing cluster maintenance and performance analysis.
26+
> 💡 **[V2.0.9 Version Update]**<br>
27+
> 👉 Added onw system tables: **[TABLE_DISK_USAGE](#_2-22-table-disk-usage)** (Table-level Storage Space Statistics), enhancing cluster maintenance and performance analysis.
2828
2929

3030
## 1. System Database
@@ -63,6 +63,7 @@ IoTDB> show tables from information_schema
6363
| regions| INF|
6464
| services| INF|
6565
| subscriptions| INF|
66+
| table_disk_usage| INF|
6667
| tables| INF|
6768
| topics| INF|
6869
| views| INF|
@@ -71,7 +72,7 @@ IoTDB> show tables from information_schema
7172

7273
## 2. System Tables
7374

74-
***Names**​: `DATABASES`, `TABLES`, `REGIONS`, `QUERIES`, `COLUMNS`, `PIPES`, `PIPE_PLUGINS`, `SUBSCRIPTION`, `TOPICS`, `VIEWS`, `MODELS`, `FUNCTIONS`, `CONFIGURATIONS`, `KEYWORDS`, `NODES`, `CONFIG_NODES`, `DATA_NODES`, `CONNECTIONS`, `CURRENT_QUERIES`, `QUERIES_COSTS_HISTOGRAM`, `SERVICES` (detailed descriptions in later sections)
75+
***Names**​: `DATABASES`, `TABLES`, `REGIONS`, `QUERIES`, `COLUMNS`, `PIPES`, `PIPE_PLUGINS`, `SUBSCRIPTION`, `TOPICS`, `VIEWS`, `MODELS`, `FUNCTIONS`, `CONFIGURATIONS`, `KEYWORDS`, `NODES`, `CONFIG_NODES`, `DATA_NODES`, `CONNECTIONS`, `CURRENT_QUERIES`, `QUERIES_COSTS_HISTOGRAM`, `SERVICES`, `TABLE_DISK_USAGE` (detailed descriptions in later sections)
7576
***Operations**​: Read-only, only supports `SELECT`, `COUNT/SHOW DEVICES`, `DESC`. Any modifications to table structure or content are not allowed and will result in an error: `"The database 'information_schema' can only be queried." `
7677
***Column Names**​: System table column names are all lowercase by default and separated by underscores (`_`).
7778

@@ -717,6 +718,80 @@ IoTDB> SELECT * FROM information_schema.services
717718
+------------+-----------+---------+
718719
```
719720

721+
##### 2.22 TABLE_DISK_USAGE
722+
> This system table is available since version V2.0.9
723+
724+
Used to display the disk space usage of specified tables (excluding views), including the size of ChunkGroups and the size of Metadata.
725+
726+
Note: Statistics are based on the actual size of data in TsFiles; therefore, deletions made via mods are not considered.
727+
728+
The table structure is shown below:
729+
730+
| Column Name | Data Type | Column Type | Description |
731+
|-----------------|-----------|-------------|----------------------------------|
732+
| database | string | Field | Database name |
733+
| table_name | string | Field | Table name |
734+
| datanode_id | int32 | Field | DataNode node ID |
735+
| region_id | int32 | Field | Region ID |
736+
| time_partition | int64 | Field | Time partition ID |
737+
| size_in_bytes | int64 | Field | Disk space occupied (in bytes) |
738+
739+
**Query Examples**:
740+
741+
```SQL
742+
-- Query all data;
743+
select * from information_schema.table_disk_usage;
744+
```
745+
746+
```Bash
747+
+---------+-------------------+-----------+---------+--------------+-------------+
748+
| database| table_name|datanode_id|region_id|time_partition|size_in_bytes|
749+
+---------+-------------------+-----------+---------+--------------+-------------+
750+
|database1| table1| 1| 3| 2864| 867|
751+
|database1| table11| 1| 3| 2864| 0|
752+
|database1| table3| 1| 3| 2864| 0|
753+
|database1| table1| 1| 3| 2865| 1411|
754+
|database1| table11| 1| 3| 2865| 0|
755+
|database1| table3| 1| 3| 2865| 0|
756+
|database1| table1| 1| 3| 2925| 590|
757+
|database1| table11| 1| 3| 2925| 0|
758+
|database1| table3| 1| 3| 2925| 0|
759+
|database1| table1| 1| 4| 2864| 883|
760+
|database1| table11| 1| 4| 2864| 0|
761+
|database1| table3| 1| 4| 2864| 0|
762+
|database1| table1| 1| 4| 2865| 1224|
763+
|database1| table11| 1| 4| 2865| 0|
764+
|database1| table3| 1| 4| 2865| 0|
765+
|database1| table1| 1| 4| 2888| 0|
766+
|database1| table11| 1| 4| 2888| 0|
767+
|database1| table3| 1| 4| 2888| 205|
768+
| etth| tab_cov_forecast| 1| 8| 0| 0|
769+
| etth| tab_real| 1| 8| 0| 963|
770+
| etth|tab_target_forecast| 1| 8| 0| 0|
771+
| etth| tab_cov_forecast| 1| 9| 0| 448|
772+
| etth| tab_real| 1| 9| 0| 0|
773+
| etth|tab_target_forecast| 1| 9| 0| 0|
774+
+---------+-------------------+-----------+---------+--------------+-------------+
775+
```
776+
777+
```SQL
778+
-- Specify query conditions;
779+
select * from information_schema.table_disk_usage where region_id = 4 and table_name like '%1';
780+
```
781+
782+
```Bash
783+
+---------+----------+-----------+---------+--------------+-------------+
784+
| database|table_name|datanode_id|region_id|time_partition|size_in_bytes|
785+
+---------+----------+-----------+---------+--------------+-------------+
786+
|database1| table1| 1| 4| 2864| 883|
787+
|database1| table11| 1| 4| 2864| 0|
788+
|database1| table1| 1| 4| 2865| 1224|
789+
|database1| table11| 1| 4| 2865| 0|
790+
|database1| table1| 1| 4| 2888| 0|
791+
|database1| table11| 1| 4| 2888| 0|
792+
+---------+----------+-----------+---------+--------------+-------------+
793+
```
794+
720795

721796
## 3. Permission Description
722797

src/UserGuide/Master/Tree/User-Manual/Maintenance-commands_apache.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,51 @@ Execution result:
302302
+--------------+-------------+---------+
303303
```
304304

305+
### 1.9 View Disk Space Usage
306+
**Description**: Returns the disk space usage of the specified `pattern`, including the size of ChunkGroups and the size of Metadata.
307+
308+
**Note**: Statistics are based on the actual size of data in TsFiles; therefore, deletions made via `mods` are not considered.
309+
310+
> Supported since version 2.0.9-beta
311+
312+
#### Syntax:
313+
```sql
314+
showDiskUsageStatement
315+
: SHOW DISK_USAGE FROM pathPattern
316+
whereClause?
317+
orderByClause?
318+
rowPaginationClause?
319+
;
320+
pathPattern
321+
: ROOT (DOT nodeName)*
322+
;
323+
```
324+
325+
**Explanation**: The `pattern` is used to match devices, must start with `ROOT`, and intermediate nodes in the path support `*` or `**`.
326+
327+
#### Result Set
328+
| Column Name | Column Type | Description |
329+
|---------------|-------------|----------------------------------|
330+
| Database | string | Database name |
331+
| DataNodeId | int32 | DataNode node ID |
332+
| RegionId | int32 | Region ID |
333+
| TimePartition | int64 | Time partition ID |
334+
| SizeInBytes | int64 | Disk space occupied (in bytes) |
335+
336+
#### Example:
337+
```sql
338+
SHOW DISK_USAGE FROM root.ln.**;
339+
```
340+
341+
**Execution Result**:
342+
```bash
343+
+--------+----------+--------+-------------+-----------+
344+
|Database|DataNodeId|RegionId|TimePartition|SizeInBytes|
345+
+--------+----------+--------+-------------+-----------+
346+
| root.ln| 1| 13| 2932| 203|
347+
+--------+----------+--------+-------------+-----------+
348+
```
349+
305350

306351
## 2. Status Setting
307352

src/UserGuide/Master/Tree/User-Manual/Maintenance-commands_timecho.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,50 @@ Execution result:
302302
+--------------+-------------+---------+
303303
```
304304

305+
### 1.9 View Disk Space Usage
306+
**Description**: Returns the disk space usage of the specified `pattern`, including the size of ChunkGroups and the size of Metadata.
307+
308+
**Note**: Statistics are based on the actual size of data in TsFiles; therefore, deletions made via `mods` are not considered.
309+
310+
> Supported since version 2.0.9
311+
312+
#### Syntax:
313+
```sql
314+
showDiskUsageStatement
315+
: SHOW DISK_USAGE FROM pathPattern
316+
whereClause?
317+
orderByClause?
318+
rowPaginationClause?
319+
;
320+
pathPattern
321+
: ROOT (DOT nodeName)*
322+
;
323+
```
324+
325+
**Explanation**: The `pattern` is used to match devices, must start with `ROOT`, and intermediate nodes in the path support `*` or `**`.
326+
327+
#### Result Set
328+
| Column Name | Column Type | Description |
329+
|---------------|-------------|----------------------------------|
330+
| Database | string | Database name |
331+
| DataNodeId | int32 | DataNode node ID |
332+
| RegionId | int32 | Region ID |
333+
| TimePartition | int64 | Time partition ID |
334+
| SizeInBytes | int64 | Disk space occupied (in bytes) |
335+
336+
#### Example:
337+
```sql
338+
SHOW DISK_USAGE FROM root.ln.**;
339+
```
340+
341+
**Execution Result**:
342+
```bash
343+
+--------+----------+--------+-------------+-----------+
344+
|Database|DataNodeId|RegionId|TimePartition|SizeInBytes|
345+
+--------+----------+--------+-------------+-----------+
346+
| root.ln| 1| 13| 2932| 203|
347+
+--------+----------+--------+-------------+-----------+
348+
```
305349

306350
## 2. Status Setting
307351

0 commit comments

Comments
 (0)