From 85c8362af160b0e57b8e0e7f38480b28b8ca0e66 Mon Sep 17 00:00:00 2001 From: Leto_b Date: Tue, 21 Apr 2026 17:02:53 +0800 Subject: [PATCH] add table_disk_usage from 2091 --- .../Table/Reference/System-Tables_apache.md | 78 ++++++++++++++++- .../Table/Reference/System-Tables_timecho.md | 81 +++++++++++++++++- .../Maintenance-commands_apache.md | 45 ++++++++++ .../Maintenance-commands_timecho.md | 44 ++++++++++ .../Reference/System-Tables_apache.md | 78 ++++++++++++++++- .../Reference/System-Tables_timecho.md | 81 +++++++++++++++++- .../Maintenance-commands_apache.md | 45 ++++++++++ .../Maintenance-commands_timecho.md | 44 ++++++++++ .../Table/Reference/System-Tables_apache.md | 82 +++++++++++++++++- .../Table/Reference/System-Tables_timecho.md | 83 ++++++++++++++++++- .../Maintenance-statement_apache.md | 51 ++++++++++++ .../Maintenance-statement_timecho.md | 53 ++++++++++++ .../Reference/System-Tables_apache.md | 82 +++++++++++++++++- .../Reference/System-Tables_timecho.md | 83 ++++++++++++++++++- .../Maintenance-statement_apache.md | 51 ++++++++++++ .../Maintenance-statement_timecho.md | 53 ++++++++++++ 16 files changed, 1018 insertions(+), 16 deletions(-) diff --git a/src/UserGuide/Master/Table/Reference/System-Tables_apache.md b/src/UserGuide/Master/Table/Reference/System-Tables_apache.md index be99de4be..a0f9f6c2f 100644 --- a/src/UserGuide/Master/Table/Reference/System-Tables_apache.md +++ b/src/UserGuide/Master/Table/Reference/System-Tables_apache.md @@ -59,6 +59,7 @@ IoTDB> show tables from information_schema | regions| INF| | services| INF| | subscriptions| INF| +| table_disk_usage| INF| | tables| INF| | topics| INF| | views| INF| @@ -67,7 +68,7 @@ IoTDB> show tables from information_schema ## 2. System Tables -* ​**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) +* ​**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) * ​**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." ` * ​**Column Names**​: System table column names are all lowercase by default and separated by underscores (`_`). @@ -713,6 +714,81 @@ IoTDB> SELECT * FROM information_schema.services +------------+-----------+---------+ ``` +##### 2.22 TABLE_DISK_USAGE +> This system table is available since version V2.0.9-beta + +Used to display the disk space usage of specified tables (excluding views), including the size of ChunkGroups and the size of Metadata. + +Note: Statistics are based on the actual size of data in TsFiles; therefore, deletions made via mods are not considered. + +The table structure is shown below: + +| Column Name | Data Type | Column Type | Description | +|-----------------|-----------|-------------|----------------------------------| +| database | string | Field | Database name | +| table_name | string | Field | Table name | +| datanode_id | int32 | Field | DataNode node ID | +| region_id | int32 | Field | Region ID | +| time_partition | int64 | Field | Time partition ID | +| size_in_bytes | int64 | Field | Disk space occupied (in bytes) | + +**Query Examples**: + +```SQL +-- Query all data; +select * from information_schema.table_disk_usage; +``` + +```Bash ++---------+-------------------+-----------+---------+--------------+-------------+ +| database| table_name|datanode_id|region_id|time_partition|size_in_bytes| ++---------+-------------------+-----------+---------+--------------+-------------+ +|database1| table1| 1| 3| 2864| 867| +|database1| table11| 1| 3| 2864| 0| +|database1| table3| 1| 3| 2864| 0| +|database1| table1| 1| 3| 2865| 1411| +|database1| table11| 1| 3| 2865| 0| +|database1| table3| 1| 3| 2865| 0| +|database1| table1| 1| 3| 2925| 590| +|database1| table11| 1| 3| 2925| 0| +|database1| table3| 1| 3| 2925| 0| +|database1| table1| 1| 4| 2864| 883| +|database1| table11| 1| 4| 2864| 0| +|database1| table3| 1| 4| 2864| 0| +|database1| table1| 1| 4| 2865| 1224| +|database1| table11| 1| 4| 2865| 0| +|database1| table3| 1| 4| 2865| 0| +|database1| table1| 1| 4| 2888| 0| +|database1| table11| 1| 4| 2888| 0| +|database1| table3| 1| 4| 2888| 205| +| etth| tab_cov_forecast| 1| 8| 0| 0| +| etth| tab_real| 1| 8| 0| 963| +| etth|tab_target_forecast| 1| 8| 0| 0| +| etth| tab_cov_forecast| 1| 9| 0| 448| +| etth| tab_real| 1| 9| 0| 0| +| etth|tab_target_forecast| 1| 9| 0| 0| ++---------+-------------------+-----------+---------+--------------+-------------+ +``` + +```SQL +-- Specify query conditions; +select * from information_schema.table_disk_usage where region_id = 4 and table_name like '%1'; +``` + +```Bash ++---------+----------+-----------+---------+--------------+-------------+ +| database|table_name|datanode_id|region_id|time_partition|size_in_bytes| ++---------+----------+-----------+---------+--------------+-------------+ +|database1| table1| 1| 4| 2864| 883| +|database1| table11| 1| 4| 2864| 0| +|database1| table1| 1| 4| 2865| 1224| +|database1| table11| 1| 4| 2865| 0| +|database1| table1| 1| 4| 2888| 0| +|database1| table11| 1| 4| 2888| 0| ++---------+----------+-----------+---------+--------------+-------------+ +``` + + ## 3. Permission Description * GRANT/REVOKE operations are not supported for the `information_schema` database or any of its tables. diff --git a/src/UserGuide/Master/Table/Reference/System-Tables_timecho.md b/src/UserGuide/Master/Table/Reference/System-Tables_timecho.md index b9850bb0a..64a383c26 100644 --- a/src/UserGuide/Master/Table/Reference/System-Tables_timecho.md +++ b/src/UserGuide/Master/Table/Reference/System-Tables_timecho.md @@ -23,8 +23,8 @@ 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. -> 💡 **[V2.0.8.2 Version Update]**
-> 👉 Added onw system tables: **[SERVICES](#_2-21-services)** (service status management), enhancing cluster maintenance and performance analysis. +> 💡 **[V2.0.9 Version Update]**
+> 👉 Added onw system tables: **[TABLE_DISK_USAGE](#_2-22-table-disk-usage)** (Table-level Storage Space Statistics), enhancing cluster maintenance and performance analysis. ## 1. System Database @@ -63,6 +63,7 @@ IoTDB> show tables from information_schema | regions| INF| | services| INF| | subscriptions| INF| +| table_disk_usage| INF| | tables| INF| | topics| INF| | views| INF| @@ -71,7 +72,7 @@ IoTDB> show tables from information_schema ## 2. System Tables -* ​**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) +* ​**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) * ​**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." ` * ​**Column Names**​: System table column names are all lowercase by default and separated by underscores (`_`). @@ -717,6 +718,80 @@ IoTDB> SELECT * FROM information_schema.services +------------+-----------+---------+ ``` +##### 2.22 TABLE_DISK_USAGE +> This system table is available since version V2.0.9 + +Used to display the disk space usage of specified tables (excluding views), including the size of ChunkGroups and the size of Metadata. + +Note: Statistics are based on the actual size of data in TsFiles; therefore, deletions made via mods are not considered. + +The table structure is shown below: + +| Column Name | Data Type | Column Type | Description | +|-----------------|-----------|-------------|----------------------------------| +| database | string | Field | Database name | +| table_name | string | Field | Table name | +| datanode_id | int32 | Field | DataNode node ID | +| region_id | int32 | Field | Region ID | +| time_partition | int64 | Field | Time partition ID | +| size_in_bytes | int64 | Field | Disk space occupied (in bytes) | + +**Query Examples**: + +```SQL +-- Query all data; +select * from information_schema.table_disk_usage; +``` + +```Bash ++---------+-------------------+-----------+---------+--------------+-------------+ +| database| table_name|datanode_id|region_id|time_partition|size_in_bytes| ++---------+-------------------+-----------+---------+--------------+-------------+ +|database1| table1| 1| 3| 2864| 867| +|database1| table11| 1| 3| 2864| 0| +|database1| table3| 1| 3| 2864| 0| +|database1| table1| 1| 3| 2865| 1411| +|database1| table11| 1| 3| 2865| 0| +|database1| table3| 1| 3| 2865| 0| +|database1| table1| 1| 3| 2925| 590| +|database1| table11| 1| 3| 2925| 0| +|database1| table3| 1| 3| 2925| 0| +|database1| table1| 1| 4| 2864| 883| +|database1| table11| 1| 4| 2864| 0| +|database1| table3| 1| 4| 2864| 0| +|database1| table1| 1| 4| 2865| 1224| +|database1| table11| 1| 4| 2865| 0| +|database1| table3| 1| 4| 2865| 0| +|database1| table1| 1| 4| 2888| 0| +|database1| table11| 1| 4| 2888| 0| +|database1| table3| 1| 4| 2888| 205| +| etth| tab_cov_forecast| 1| 8| 0| 0| +| etth| tab_real| 1| 8| 0| 963| +| etth|tab_target_forecast| 1| 8| 0| 0| +| etth| tab_cov_forecast| 1| 9| 0| 448| +| etth| tab_real| 1| 9| 0| 0| +| etth|tab_target_forecast| 1| 9| 0| 0| ++---------+-------------------+-----------+---------+--------------+-------------+ +``` + +```SQL +-- Specify query conditions; +select * from information_schema.table_disk_usage where region_id = 4 and table_name like '%1'; +``` + +```Bash ++---------+----------+-----------+---------+--------------+-------------+ +| database|table_name|datanode_id|region_id|time_partition|size_in_bytes| ++---------+----------+-----------+---------+--------------+-------------+ +|database1| table1| 1| 4| 2864| 883| +|database1| table11| 1| 4| 2864| 0| +|database1| table1| 1| 4| 2865| 1224| +|database1| table11| 1| 4| 2865| 0| +|database1| table1| 1| 4| 2888| 0| +|database1| table11| 1| 4| 2888| 0| ++---------+----------+-----------+---------+--------------+-------------+ +``` + ## 3. Permission Description diff --git a/src/UserGuide/Master/Tree/User-Manual/Maintenance-commands_apache.md b/src/UserGuide/Master/Tree/User-Manual/Maintenance-commands_apache.md index af354af4d..55f14c680 100644 --- a/src/UserGuide/Master/Tree/User-Manual/Maintenance-commands_apache.md +++ b/src/UserGuide/Master/Tree/User-Manual/Maintenance-commands_apache.md @@ -302,6 +302,51 @@ Execution result: +--------------+-------------+---------+ ``` +### 1.9 View Disk Space Usage +**Description**: Returns the disk space usage of the specified `pattern`, including the size of ChunkGroups and the size of Metadata. + +**Note**: Statistics are based on the actual size of data in TsFiles; therefore, deletions made via `mods` are not considered. + +> Supported since version 2.0.9-beta + +#### Syntax: +```sql +showDiskUsageStatement + : SHOW DISK_USAGE FROM pathPattern + whereClause? + orderByClause? + rowPaginationClause? + ; +pathPattern + : ROOT (DOT nodeName)* + ; +``` + +**Explanation**: The `pattern` is used to match devices, must start with `ROOT`, and intermediate nodes in the path support `*` or `**`. + +#### Result Set +| Column Name | Column Type | Description | +|---------------|-------------|----------------------------------| +| Database | string | Database name | +| DataNodeId | int32 | DataNode node ID | +| RegionId | int32 | Region ID | +| TimePartition | int64 | Time partition ID | +| SizeInBytes | int64 | Disk space occupied (in bytes) | + +#### Example: +```sql +SHOW DISK_USAGE FROM root.ln.**; +``` + +**Execution Result**: +```bash ++--------+----------+--------+-------------+-----------+ +|Database|DataNodeId|RegionId|TimePartition|SizeInBytes| ++--------+----------+--------+-------------+-----------+ +| root.ln| 1| 13| 2932| 203| ++--------+----------+--------+-------------+-----------+ +``` + ## 2. Status Setting diff --git a/src/UserGuide/Master/Tree/User-Manual/Maintenance-commands_timecho.md b/src/UserGuide/Master/Tree/User-Manual/Maintenance-commands_timecho.md index 54259334a..b19c029d3 100644 --- a/src/UserGuide/Master/Tree/User-Manual/Maintenance-commands_timecho.md +++ b/src/UserGuide/Master/Tree/User-Manual/Maintenance-commands_timecho.md @@ -302,6 +302,50 @@ Execution result: +--------------+-------------+---------+ ``` +### 1.9 View Disk Space Usage +**Description**: Returns the disk space usage of the specified `pattern`, including the size of ChunkGroups and the size of Metadata. + +**Note**: Statistics are based on the actual size of data in TsFiles; therefore, deletions made via `mods` are not considered. + +> Supported since version 2.0.9 + +#### Syntax: +```sql +showDiskUsageStatement + : SHOW DISK_USAGE FROM pathPattern + whereClause? + orderByClause? + rowPaginationClause? + ; +pathPattern + : ROOT (DOT nodeName)* + ; +``` + +**Explanation**: The `pattern` is used to match devices, must start with `ROOT`, and intermediate nodes in the path support `*` or `**`. + +#### Result Set +| Column Name | Column Type | Description | +|---------------|-------------|----------------------------------| +| Database | string | Database name | +| DataNodeId | int32 | DataNode node ID | +| RegionId | int32 | Region ID | +| TimePartition | int64 | Time partition ID | +| SizeInBytes | int64 | Disk space occupied (in bytes) | + +#### Example: +```sql +SHOW DISK_USAGE FROM root.ln.**; +``` + +**Execution Result**: +```bash ++--------+----------+--------+-------------+-----------+ +|Database|DataNodeId|RegionId|TimePartition|SizeInBytes| ++--------+----------+--------+-------------+-----------+ +| root.ln| 1| 13| 2932| 203| ++--------+----------+--------+-------------+-----------+ +``` ## 2. Status Setting diff --git a/src/UserGuide/latest-Table/Reference/System-Tables_apache.md b/src/UserGuide/latest-Table/Reference/System-Tables_apache.md index be99de4be..a0f9f6c2f 100644 --- a/src/UserGuide/latest-Table/Reference/System-Tables_apache.md +++ b/src/UserGuide/latest-Table/Reference/System-Tables_apache.md @@ -59,6 +59,7 @@ IoTDB> show tables from information_schema | regions| INF| | services| INF| | subscriptions| INF| +| table_disk_usage| INF| | tables| INF| | topics| INF| | views| INF| @@ -67,7 +68,7 @@ IoTDB> show tables from information_schema ## 2. System Tables -* ​**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) +* ​**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) * ​**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." ` * ​**Column Names**​: System table column names are all lowercase by default and separated by underscores (`_`). @@ -713,6 +714,81 @@ IoTDB> SELECT * FROM information_schema.services +------------+-----------+---------+ ``` +##### 2.22 TABLE_DISK_USAGE +> This system table is available since version V2.0.9-beta + +Used to display the disk space usage of specified tables (excluding views), including the size of ChunkGroups and the size of Metadata. + +Note: Statistics are based on the actual size of data in TsFiles; therefore, deletions made via mods are not considered. + +The table structure is shown below: + +| Column Name | Data Type | Column Type | Description | +|-----------------|-----------|-------------|----------------------------------| +| database | string | Field | Database name | +| table_name | string | Field | Table name | +| datanode_id | int32 | Field | DataNode node ID | +| region_id | int32 | Field | Region ID | +| time_partition | int64 | Field | Time partition ID | +| size_in_bytes | int64 | Field | Disk space occupied (in bytes) | + +**Query Examples**: + +```SQL +-- Query all data; +select * from information_schema.table_disk_usage; +``` + +```Bash ++---------+-------------------+-----------+---------+--------------+-------------+ +| database| table_name|datanode_id|region_id|time_partition|size_in_bytes| ++---------+-------------------+-----------+---------+--------------+-------------+ +|database1| table1| 1| 3| 2864| 867| +|database1| table11| 1| 3| 2864| 0| +|database1| table3| 1| 3| 2864| 0| +|database1| table1| 1| 3| 2865| 1411| +|database1| table11| 1| 3| 2865| 0| +|database1| table3| 1| 3| 2865| 0| +|database1| table1| 1| 3| 2925| 590| +|database1| table11| 1| 3| 2925| 0| +|database1| table3| 1| 3| 2925| 0| +|database1| table1| 1| 4| 2864| 883| +|database1| table11| 1| 4| 2864| 0| +|database1| table3| 1| 4| 2864| 0| +|database1| table1| 1| 4| 2865| 1224| +|database1| table11| 1| 4| 2865| 0| +|database1| table3| 1| 4| 2865| 0| +|database1| table1| 1| 4| 2888| 0| +|database1| table11| 1| 4| 2888| 0| +|database1| table3| 1| 4| 2888| 205| +| etth| tab_cov_forecast| 1| 8| 0| 0| +| etth| tab_real| 1| 8| 0| 963| +| etth|tab_target_forecast| 1| 8| 0| 0| +| etth| tab_cov_forecast| 1| 9| 0| 448| +| etth| tab_real| 1| 9| 0| 0| +| etth|tab_target_forecast| 1| 9| 0| 0| ++---------+-------------------+-----------+---------+--------------+-------------+ +``` + +```SQL +-- Specify query conditions; +select * from information_schema.table_disk_usage where region_id = 4 and table_name like '%1'; +``` + +```Bash ++---------+----------+-----------+---------+--------------+-------------+ +| database|table_name|datanode_id|region_id|time_partition|size_in_bytes| ++---------+----------+-----------+---------+--------------+-------------+ +|database1| table1| 1| 4| 2864| 883| +|database1| table11| 1| 4| 2864| 0| +|database1| table1| 1| 4| 2865| 1224| +|database1| table11| 1| 4| 2865| 0| +|database1| table1| 1| 4| 2888| 0| +|database1| table11| 1| 4| 2888| 0| ++---------+----------+-----------+---------+--------------+-------------+ +``` + + ## 3. Permission Description * GRANT/REVOKE operations are not supported for the `information_schema` database or any of its tables. diff --git a/src/UserGuide/latest-Table/Reference/System-Tables_timecho.md b/src/UserGuide/latest-Table/Reference/System-Tables_timecho.md index b9850bb0a..64a383c26 100644 --- a/src/UserGuide/latest-Table/Reference/System-Tables_timecho.md +++ b/src/UserGuide/latest-Table/Reference/System-Tables_timecho.md @@ -23,8 +23,8 @@ 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. -> 💡 **[V2.0.8.2 Version Update]**
-> 👉 Added onw system tables: **[SERVICES](#_2-21-services)** (service status management), enhancing cluster maintenance and performance analysis. +> 💡 **[V2.0.9 Version Update]**
+> 👉 Added onw system tables: **[TABLE_DISK_USAGE](#_2-22-table-disk-usage)** (Table-level Storage Space Statistics), enhancing cluster maintenance and performance analysis. ## 1. System Database @@ -63,6 +63,7 @@ IoTDB> show tables from information_schema | regions| INF| | services| INF| | subscriptions| INF| +| table_disk_usage| INF| | tables| INF| | topics| INF| | views| INF| @@ -71,7 +72,7 @@ IoTDB> show tables from information_schema ## 2. System Tables -* ​**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) +* ​**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) * ​**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." ` * ​**Column Names**​: System table column names are all lowercase by default and separated by underscores (`_`). @@ -717,6 +718,80 @@ IoTDB> SELECT * FROM information_schema.services +------------+-----------+---------+ ``` +##### 2.22 TABLE_DISK_USAGE +> This system table is available since version V2.0.9 + +Used to display the disk space usage of specified tables (excluding views), including the size of ChunkGroups and the size of Metadata. + +Note: Statistics are based on the actual size of data in TsFiles; therefore, deletions made via mods are not considered. + +The table structure is shown below: + +| Column Name | Data Type | Column Type | Description | +|-----------------|-----------|-------------|----------------------------------| +| database | string | Field | Database name | +| table_name | string | Field | Table name | +| datanode_id | int32 | Field | DataNode node ID | +| region_id | int32 | Field | Region ID | +| time_partition | int64 | Field | Time partition ID | +| size_in_bytes | int64 | Field | Disk space occupied (in bytes) | + +**Query Examples**: + +```SQL +-- Query all data; +select * from information_schema.table_disk_usage; +``` + +```Bash ++---------+-------------------+-----------+---------+--------------+-------------+ +| database| table_name|datanode_id|region_id|time_partition|size_in_bytes| ++---------+-------------------+-----------+---------+--------------+-------------+ +|database1| table1| 1| 3| 2864| 867| +|database1| table11| 1| 3| 2864| 0| +|database1| table3| 1| 3| 2864| 0| +|database1| table1| 1| 3| 2865| 1411| +|database1| table11| 1| 3| 2865| 0| +|database1| table3| 1| 3| 2865| 0| +|database1| table1| 1| 3| 2925| 590| +|database1| table11| 1| 3| 2925| 0| +|database1| table3| 1| 3| 2925| 0| +|database1| table1| 1| 4| 2864| 883| +|database1| table11| 1| 4| 2864| 0| +|database1| table3| 1| 4| 2864| 0| +|database1| table1| 1| 4| 2865| 1224| +|database1| table11| 1| 4| 2865| 0| +|database1| table3| 1| 4| 2865| 0| +|database1| table1| 1| 4| 2888| 0| +|database1| table11| 1| 4| 2888| 0| +|database1| table3| 1| 4| 2888| 205| +| etth| tab_cov_forecast| 1| 8| 0| 0| +| etth| tab_real| 1| 8| 0| 963| +| etth|tab_target_forecast| 1| 8| 0| 0| +| etth| tab_cov_forecast| 1| 9| 0| 448| +| etth| tab_real| 1| 9| 0| 0| +| etth|tab_target_forecast| 1| 9| 0| 0| ++---------+-------------------+-----------+---------+--------------+-------------+ +``` + +```SQL +-- Specify query conditions; +select * from information_schema.table_disk_usage where region_id = 4 and table_name like '%1'; +``` + +```Bash ++---------+----------+-----------+---------+--------------+-------------+ +| database|table_name|datanode_id|region_id|time_partition|size_in_bytes| ++---------+----------+-----------+---------+--------------+-------------+ +|database1| table1| 1| 4| 2864| 883| +|database1| table11| 1| 4| 2864| 0| +|database1| table1| 1| 4| 2865| 1224| +|database1| table11| 1| 4| 2865| 0| +|database1| table1| 1| 4| 2888| 0| +|database1| table11| 1| 4| 2888| 0| ++---------+----------+-----------+---------+--------------+-------------+ +``` + ## 3. Permission Description diff --git a/src/UserGuide/latest/User-Manual/Maintenance-commands_apache.md b/src/UserGuide/latest/User-Manual/Maintenance-commands_apache.md index af354af4d..55f14c680 100644 --- a/src/UserGuide/latest/User-Manual/Maintenance-commands_apache.md +++ b/src/UserGuide/latest/User-Manual/Maintenance-commands_apache.md @@ -302,6 +302,51 @@ Execution result: +--------------+-------------+---------+ ``` +### 1.9 View Disk Space Usage +**Description**: Returns the disk space usage of the specified `pattern`, including the size of ChunkGroups and the size of Metadata. + +**Note**: Statistics are based on the actual size of data in TsFiles; therefore, deletions made via `mods` are not considered. + +> Supported since version 2.0.9-beta + +#### Syntax: +```sql +showDiskUsageStatement + : SHOW DISK_USAGE FROM pathPattern + whereClause? + orderByClause? + rowPaginationClause? + ; +pathPattern + : ROOT (DOT nodeName)* + ; +``` + +**Explanation**: The `pattern` is used to match devices, must start with `ROOT`, and intermediate nodes in the path support `*` or `**`. + +#### Result Set +| Column Name | Column Type | Description | +|---------------|-------------|----------------------------------| +| Database | string | Database name | +| DataNodeId | int32 | DataNode node ID | +| RegionId | int32 | Region ID | +| TimePartition | int64 | Time partition ID | +| SizeInBytes | int64 | Disk space occupied (in bytes) | + +#### Example: +```sql +SHOW DISK_USAGE FROM root.ln.**; +``` + +**Execution Result**: +```bash ++--------+----------+--------+-------------+-----------+ +|Database|DataNodeId|RegionId|TimePartition|SizeInBytes| ++--------+----------+--------+-------------+-----------+ +| root.ln| 1| 13| 2932| 203| ++--------+----------+--------+-------------+-----------+ +``` + ## 2. Status Setting diff --git a/src/UserGuide/latest/User-Manual/Maintenance-commands_timecho.md b/src/UserGuide/latest/User-Manual/Maintenance-commands_timecho.md index 54259334a..b19c029d3 100644 --- a/src/UserGuide/latest/User-Manual/Maintenance-commands_timecho.md +++ b/src/UserGuide/latest/User-Manual/Maintenance-commands_timecho.md @@ -302,6 +302,50 @@ Execution result: +--------------+-------------+---------+ ``` +### 1.9 View Disk Space Usage +**Description**: Returns the disk space usage of the specified `pattern`, including the size of ChunkGroups and the size of Metadata. + +**Note**: Statistics are based on the actual size of data in TsFiles; therefore, deletions made via `mods` are not considered. + +> Supported since version 2.0.9 + +#### Syntax: +```sql +showDiskUsageStatement + : SHOW DISK_USAGE FROM pathPattern + whereClause? + orderByClause? + rowPaginationClause? + ; +pathPattern + : ROOT (DOT nodeName)* + ; +``` + +**Explanation**: The `pattern` is used to match devices, must start with `ROOT`, and intermediate nodes in the path support `*` or `**`. + +#### Result Set +| Column Name | Column Type | Description | +|---------------|-------------|----------------------------------| +| Database | string | Database name | +| DataNodeId | int32 | DataNode node ID | +| RegionId | int32 | Region ID | +| TimePartition | int64 | Time partition ID | +| SizeInBytes | int64 | Disk space occupied (in bytes) | + +#### Example: +```sql +SHOW DISK_USAGE FROM root.ln.**; +``` + +**Execution Result**: +```bash ++--------+----------+--------+-------------+-----------+ +|Database|DataNodeId|RegionId|TimePartition|SizeInBytes| ++--------+----------+--------+-------------+-----------+ +| root.ln| 1| 13| 2932| 203| ++--------+----------+--------+-------------+-----------+ +``` ## 2. Status Setting diff --git a/src/zh/UserGuide/Master/Table/Reference/System-Tables_apache.md b/src/zh/UserGuide/Master/Table/Reference/System-Tables_apache.md index e1ad8b5f3..ea7b472e3 100644 --- a/src/zh/UserGuide/Master/Table/Reference/System-Tables_apache.md +++ b/src/zh/UserGuide/Master/Table/Reference/System-Tables_apache.md @@ -59,6 +59,7 @@ IoTDB> show tables from information_schema | regions| INF| | services| INF| | subscriptions| INF| +| table_disk_usage| INF| | tables| INF| | topics| INF| | views| INF| @@ -67,7 +68,7 @@ IoTDB> show tables from information_schema ## 2. 系统表 -* 名称:`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`(详细介绍见后面小节) +* 名称:`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`(详细介绍见后面小节) * 操作:只读,只支持`SELECT`, `COUNT/SHOW DEVICES`, `DESC`,不支持对于表结构 / 内容的任意修改,如果修改将会报错:`"The database 'information_schema' can only be queried"` * 列名:系统表的列名均默认为小写,且用`_`分隔 @@ -704,6 +705,85 @@ IoTDB> select * from information_schema.services +------------+-----------+-------+ ``` + +##### 2.22 TABLE_DISK_USAGE 表 + +> 该系统表从 V 2.0.9-beta 版本开始提供 + +用于展示指定表(不包含 view)的磁盘空间占用情况,包括 ChunkGroup 的大小和 Metadata 大小。 + +注意:统计基于 TsFile 中数据的真实大小,因此不会考虑 mods 删除的情况。 + +表结构如下表所示: + +| 列名 | 数据类型 | 列类型 | 说明 | +| ----------------- | ---------- | -------- | -------------------- | +| database | string | Field | Database 名 | +| table\_name | string | Field | 表名 | +| datanode\_id | int32 | Field | DataNode 节点 id | +| region\_id | int32 | Field | Region id | +| time\_partition | int64 | Field | 时间分区 id | +| size\_in\_bytes | int64 | Field | 占用磁盘空间(byte) | + +查询示例: + +```SQL +-- 查询所有数据; +select * from information_schema.table_disk_usage; +``` + +```Bash ++---------+-------------------+-----------+---------+--------------+-------------+ +| database| table_name|datanode_id|region_id|time_partition|size_in_bytes| ++---------+-------------------+-----------+---------+--------------+-------------+ +|database1| table1| 1| 3| 2864| 867| +|database1| table11| 1| 3| 2864| 0| +|database1| table3| 1| 3| 2864| 0| +|database1| table1| 1| 3| 2865| 1411| +|database1| table11| 1| 3| 2865| 0| +|database1| table3| 1| 3| 2865| 0| +|database1| table1| 1| 3| 2925| 590| +|database1| table11| 1| 3| 2925| 0| +|database1| table3| 1| 3| 2925| 0| +|database1| table1| 1| 4| 2864| 883| +|database1| table11| 1| 4| 2864| 0| +|database1| table3| 1| 4| 2864| 0| +|database1| table1| 1| 4| 2865| 1224| +|database1| table11| 1| 4| 2865| 0| +|database1| table3| 1| 4| 2865| 0| +|database1| table1| 1| 4| 2888| 0| +|database1| table11| 1| 4| 2888| 0| +|database1| table3| 1| 4| 2888| 205| +| etth| tab_cov_forecast| 1| 8| 0| 0| +| etth| tab_real| 1| 8| 0| 963| +| etth|tab_target_forecast| 1| 8| 0| 0| +| etth| tab_cov_forecast| 1| 9| 0| 448| +| etth| tab_real| 1| 9| 0| 0| +| etth|tab_target_forecast| 1| 9| 0| 0| ++---------+-------------------+-----------+---------+--------------+-------------+ +``` + +```SQL +-- 指定查询条件; +select * from information_schema.table_disk_usage where region_id = 4 and table_name like '%1'; +``` + +```Bash ++---------+----------+-----------+---------+--------------+-------------+ +| database|table_name|datanode_id|region_id|time_partition|size_in_bytes| ++---------+----------+-----------+---------+--------------+-------------+ +|database1| table1| 1| 4| 2864| 883| +|database1| table11| 1| 4| 2864| 0| +|database1| table1| 1| 4| 2865| 1224| +|database1| table11| 1| 4| 2865| 0| +|database1| table1| 1| 4| 2888| 0| +|database1| table11| 1| 4| 2888| 0| ++---------+----------+-----------+---------+--------------+-------------+ +``` + + + + ## 3. 权限说明 * 不支持通过`GRANT/REVOKE`语句对 `information_schema` 数据库及其下任何表进行权限操作 diff --git a/src/zh/UserGuide/Master/Table/Reference/System-Tables_timecho.md b/src/zh/UserGuide/Master/Table/Reference/System-Tables_timecho.md index 1ba09895d..94d50f653 100644 --- a/src/zh/UserGuide/Master/Table/Reference/System-Tables_timecho.md +++ b/src/zh/UserGuide/Master/Table/Reference/System-Tables_timecho.md @@ -23,8 +23,8 @@ IoTDB 内置系统数据库 `INFORMATION_SCHEMA`,其中包含一系列系统表,用于存储 IoTDB 运行时信息(如当前正在执行的 SQL 语句等)。目前`INFORMATION_SCHEMA`数据库只支持读操作。 -> 💡 **【V2.0.8.2 版本更新】**
-> 👉 新增一张系统表:**[SERVICES](#_2-21-services-表)**(服务状态管理),助力集群运维与性能分析。 +> 💡 **【V2.0.9 版本更新】**
+> 👉 新增一张系统表:**[TABLE_DISK_USAGE](#_2-22-table-disk-usage-表)**(表级存储空间统计),助力集群运维与性能分析。 ## 1. 系统库 @@ -62,6 +62,7 @@ IoTDB> show tables from information_schema | regions| INF| | services| INF| | subscriptions| INF| +| table_disk_usage| INF| | tables| INF| | topics| INF| | views| INF| @@ -70,7 +71,7 @@ IoTDB> show tables from information_schema ## 2. 系统表 -* 名称:`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`(详细介绍见后面小节) +* 名称:`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`(详细介绍见后面小节) * 操作:只读,只支持`SELECT`, `COUNT/SHOW DEVICES`, `DESC`,不支持对于表结构 / 内容的任意修改,如果修改将会报错:`"The database 'information_schema' can only be queried"` * 列名:系统表的列名均默认为小写,且用`_`分隔 @@ -708,6 +709,82 @@ IoTDB> select * from information_schema.services +------------+-----------+-------+ ``` +##### 2.22 TABLE_DISK_USAGE 表 + +> 该系统表从 V 2.0.9 版本开始提供 + +用于展示指定表(不包含 view)的磁盘空间占用情况,包括 ChunkGroup 的大小和 Metadata 大小。 + +注意:统计基于 TsFile 中数据的真实大小,因此不会考虑 mods 删除的情况。 + +表结构如下表所示: + +| 列名 | 数据类型 | 列类型 | 说明 | +| ----------------- | ---------- | -------- | -------------------- | +| database | string | Field | Database 名 | +| table\_name | string | Field | 表名 | +| datanode\_id | int32 | Field | DataNode 节点 id | +| region\_id | int32 | Field | Region id | +| time\_partition | int64 | Field | 时间分区 id | +| size\_in\_bytes | int64 | Field | 占用磁盘空间(byte) | + +查询示例: + +```SQL +-- 查询所有数据; +select * from information_schema.table_disk_usage; +``` + +```Bash ++---------+-------------------+-----------+---------+--------------+-------------+ +| database| table_name|datanode_id|region_id|time_partition|size_in_bytes| ++---------+-------------------+-----------+---------+--------------+-------------+ +|database1| table1| 1| 3| 2864| 867| +|database1| table11| 1| 3| 2864| 0| +|database1| table3| 1| 3| 2864| 0| +|database1| table1| 1| 3| 2865| 1411| +|database1| table11| 1| 3| 2865| 0| +|database1| table3| 1| 3| 2865| 0| +|database1| table1| 1| 3| 2925| 590| +|database1| table11| 1| 3| 2925| 0| +|database1| table3| 1| 3| 2925| 0| +|database1| table1| 1| 4| 2864| 883| +|database1| table11| 1| 4| 2864| 0| +|database1| table3| 1| 4| 2864| 0| +|database1| table1| 1| 4| 2865| 1224| +|database1| table11| 1| 4| 2865| 0| +|database1| table3| 1| 4| 2865| 0| +|database1| table1| 1| 4| 2888| 0| +|database1| table11| 1| 4| 2888| 0| +|database1| table3| 1| 4| 2888| 205| +| etth| tab_cov_forecast| 1| 8| 0| 0| +| etth| tab_real| 1| 8| 0| 963| +| etth|tab_target_forecast| 1| 8| 0| 0| +| etth| tab_cov_forecast| 1| 9| 0| 448| +| etth| tab_real| 1| 9| 0| 0| +| etth|tab_target_forecast| 1| 9| 0| 0| ++---------+-------------------+-----------+---------+--------------+-------------+ +``` + +```SQL +-- 指定查询条件; +select * from information_schema.table_disk_usage where region_id = 4 and table_name like '%1'; +``` + +```Bash ++---------+----------+-----------+---------+--------------+-------------+ +| database|table_name|datanode_id|region_id|time_partition|size_in_bytes| ++---------+----------+-----------+---------+--------------+-------------+ +|database1| table1| 1| 4| 2864| 883| +|database1| table11| 1| 4| 2864| 0| +|database1| table1| 1| 4| 2865| 1224| +|database1| table11| 1| 4| 2865| 0| +|database1| table1| 1| 4| 2888| 0| +|database1| table11| 1| 4| 2888| 0| ++---------+----------+-----------+---------+--------------+-------------+ +``` + + ## 3. 权限说明 * 不支持通过`GRANT/REVOKE`语句对 `information_schema` 数据库及其下任何表进行权限操作 diff --git a/src/zh/UserGuide/Master/Tree/User-Manual/Maintenance-statement_apache.md b/src/zh/UserGuide/Master/Tree/User-Manual/Maintenance-statement_apache.md index 012236f2f..10f7aea21 100644 --- a/src/zh/UserGuide/Master/Tree/User-Manual/Maintenance-statement_apache.md +++ b/src/zh/UserGuide/Master/Tree/User-Manual/Maintenance-statement_apache.md @@ -306,6 +306,57 @@ IoTDB> SHOW SERVICES ON 1 +------------+-----------+-------+ ``` +### 1.9 查看磁盘空间占用情况 + +含义:返回指定 pattern 的磁盘空间占用情况,包括 ChunkGroup 的大小和 Metadata 大小。 + +注意:统计基于 TsFile 中数据的真实大小,因此不会考虑 mods 删除的情况。 + +> V2.0.9-beta 起支持该功能 + +#### 语法: + +```SQL +showDiskUsageStatement + : SHOW DISK_USAGE FROM pathPattern + whereClause? + orderByClause? + rowPaginationClause? + ; +pathPattern + : ROOT (DOT nodeName)* + ; +``` + +说明:Pattern 用于匹配设备,需要使用 root 作为开头,路径的中间节点支持 * 或 **。 + +#### 结果集 + +| 列名 | 列类型 | 含义 | +| --------------- | -------- | -------------------- | +| Database | string | Database 名 | +| DataNodeId | int32 | DataNode 节点 id | +| RegionId | int32 | Region id | +| TimePartition | int64 | 时间分区 id | +| SizeInBytes | int64 | 占用磁盘空间(byte) | + +#### 示例: + +```SQL +SHOW DISK_USAGE FROM root.ln.**; +``` + +执行结果如下: + +```Bash ++--------+----------+--------+-------------+-----------+ +|Database|DataNodeId|RegionId|TimePartition|SizeInBytes| ++--------+----------+--------+-------------+-----------+ +| root.ln| 1| 13| 2932| 203| ++--------+----------+--------+-------------+-----------+ +``` + + ## 2. 状态设置 ### 2.1 设置连接的模型 diff --git a/src/zh/UserGuide/Master/Tree/User-Manual/Maintenance-statement_timecho.md b/src/zh/UserGuide/Master/Tree/User-Manual/Maintenance-statement_timecho.md index c5b369ca7..dc592f168 100644 --- a/src/zh/UserGuide/Master/Tree/User-Manual/Maintenance-statement_timecho.md +++ b/src/zh/UserGuide/Master/Tree/User-Manual/Maintenance-statement_timecho.md @@ -306,6 +306,59 @@ IoTDB> SHOW SERVICES ON 1 +------------+-----------+-------+ ``` + +### 1.9 查看磁盘空间占用情况 + +含义:返回指定 pattern 的磁盘空间占用情况,包括 ChunkGroup 的大小和 Metadata 大小。 + +注意:统计基于 TsFile 中数据的真实大小,因此不会考虑 mods 删除的情况。 + +> V2.0.9 起支持该功能 + +#### 语法: + +```SQL +showDiskUsageStatement + : SHOW DISK_USAGE FROM pathPattern + whereClause? + orderByClause? + rowPaginationClause? + ; +pathPattern + : ROOT (DOT nodeName)* + ; +``` + +说明:Pattern 用于匹配设备,需要使用 root 作为开头,路径的中间节点支持 * 或 **。 + +#### 结果集 + +| 列名 | 列类型 | 含义 | +| --------------- | -------- | -------------------- | +| Database | string | Database 名 | +| DataNodeId | int32 | DataNode 节点 id | +| RegionId | int32 | Region id | +| TimePartition | int64 | 时间分区 id | +| SizeInBytes | int64 | 占用磁盘空间(byte) | + +#### 示例: + +```SQL +SHOW DISK_USAGE FROM root.ln.**; +``` + +执行结果如下: + +```Bash ++--------+----------+--------+-------------+-----------+ +|Database|DataNodeId|RegionId|TimePartition|SizeInBytes| ++--------+----------+--------+-------------+-----------+ +| root.ln| 1| 13| 2932| 203| ++--------+----------+--------+-------------+-----------+ +``` + + + ## 2. 状态设置 ### 2.1 设置连接的模型 diff --git a/src/zh/UserGuide/latest-Table/Reference/System-Tables_apache.md b/src/zh/UserGuide/latest-Table/Reference/System-Tables_apache.md index e1ad8b5f3..ea7b472e3 100644 --- a/src/zh/UserGuide/latest-Table/Reference/System-Tables_apache.md +++ b/src/zh/UserGuide/latest-Table/Reference/System-Tables_apache.md @@ -59,6 +59,7 @@ IoTDB> show tables from information_schema | regions| INF| | services| INF| | subscriptions| INF| +| table_disk_usage| INF| | tables| INF| | topics| INF| | views| INF| @@ -67,7 +68,7 @@ IoTDB> show tables from information_schema ## 2. 系统表 -* 名称:`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`(详细介绍见后面小节) +* 名称:`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`(详细介绍见后面小节) * 操作:只读,只支持`SELECT`, `COUNT/SHOW DEVICES`, `DESC`,不支持对于表结构 / 内容的任意修改,如果修改将会报错:`"The database 'information_schema' can only be queried"` * 列名:系统表的列名均默认为小写,且用`_`分隔 @@ -704,6 +705,85 @@ IoTDB> select * from information_schema.services +------------+-----------+-------+ ``` + +##### 2.22 TABLE_DISK_USAGE 表 + +> 该系统表从 V 2.0.9-beta 版本开始提供 + +用于展示指定表(不包含 view)的磁盘空间占用情况,包括 ChunkGroup 的大小和 Metadata 大小。 + +注意:统计基于 TsFile 中数据的真实大小,因此不会考虑 mods 删除的情况。 + +表结构如下表所示: + +| 列名 | 数据类型 | 列类型 | 说明 | +| ----------------- | ---------- | -------- | -------------------- | +| database | string | Field | Database 名 | +| table\_name | string | Field | 表名 | +| datanode\_id | int32 | Field | DataNode 节点 id | +| region\_id | int32 | Field | Region id | +| time\_partition | int64 | Field | 时间分区 id | +| size\_in\_bytes | int64 | Field | 占用磁盘空间(byte) | + +查询示例: + +```SQL +-- 查询所有数据; +select * from information_schema.table_disk_usage; +``` + +```Bash ++---------+-------------------+-----------+---------+--------------+-------------+ +| database| table_name|datanode_id|region_id|time_partition|size_in_bytes| ++---------+-------------------+-----------+---------+--------------+-------------+ +|database1| table1| 1| 3| 2864| 867| +|database1| table11| 1| 3| 2864| 0| +|database1| table3| 1| 3| 2864| 0| +|database1| table1| 1| 3| 2865| 1411| +|database1| table11| 1| 3| 2865| 0| +|database1| table3| 1| 3| 2865| 0| +|database1| table1| 1| 3| 2925| 590| +|database1| table11| 1| 3| 2925| 0| +|database1| table3| 1| 3| 2925| 0| +|database1| table1| 1| 4| 2864| 883| +|database1| table11| 1| 4| 2864| 0| +|database1| table3| 1| 4| 2864| 0| +|database1| table1| 1| 4| 2865| 1224| +|database1| table11| 1| 4| 2865| 0| +|database1| table3| 1| 4| 2865| 0| +|database1| table1| 1| 4| 2888| 0| +|database1| table11| 1| 4| 2888| 0| +|database1| table3| 1| 4| 2888| 205| +| etth| tab_cov_forecast| 1| 8| 0| 0| +| etth| tab_real| 1| 8| 0| 963| +| etth|tab_target_forecast| 1| 8| 0| 0| +| etth| tab_cov_forecast| 1| 9| 0| 448| +| etth| tab_real| 1| 9| 0| 0| +| etth|tab_target_forecast| 1| 9| 0| 0| ++---------+-------------------+-----------+---------+--------------+-------------+ +``` + +```SQL +-- 指定查询条件; +select * from information_schema.table_disk_usage where region_id = 4 and table_name like '%1'; +``` + +```Bash ++---------+----------+-----------+---------+--------------+-------------+ +| database|table_name|datanode_id|region_id|time_partition|size_in_bytes| ++---------+----------+-----------+---------+--------------+-------------+ +|database1| table1| 1| 4| 2864| 883| +|database1| table11| 1| 4| 2864| 0| +|database1| table1| 1| 4| 2865| 1224| +|database1| table11| 1| 4| 2865| 0| +|database1| table1| 1| 4| 2888| 0| +|database1| table11| 1| 4| 2888| 0| ++---------+----------+-----------+---------+--------------+-------------+ +``` + + + + ## 3. 权限说明 * 不支持通过`GRANT/REVOKE`语句对 `information_schema` 数据库及其下任何表进行权限操作 diff --git a/src/zh/UserGuide/latest-Table/Reference/System-Tables_timecho.md b/src/zh/UserGuide/latest-Table/Reference/System-Tables_timecho.md index 1ba09895d..94d50f653 100644 --- a/src/zh/UserGuide/latest-Table/Reference/System-Tables_timecho.md +++ b/src/zh/UserGuide/latest-Table/Reference/System-Tables_timecho.md @@ -23,8 +23,8 @@ IoTDB 内置系统数据库 `INFORMATION_SCHEMA`,其中包含一系列系统表,用于存储 IoTDB 运行时信息(如当前正在执行的 SQL 语句等)。目前`INFORMATION_SCHEMA`数据库只支持读操作。 -> 💡 **【V2.0.8.2 版本更新】**
-> 👉 新增一张系统表:**[SERVICES](#_2-21-services-表)**(服务状态管理),助力集群运维与性能分析。 +> 💡 **【V2.0.9 版本更新】**
+> 👉 新增一张系统表:**[TABLE_DISK_USAGE](#_2-22-table-disk-usage-表)**(表级存储空间统计),助力集群运维与性能分析。 ## 1. 系统库 @@ -62,6 +62,7 @@ IoTDB> show tables from information_schema | regions| INF| | services| INF| | subscriptions| INF| +| table_disk_usage| INF| | tables| INF| | topics| INF| | views| INF| @@ -70,7 +71,7 @@ IoTDB> show tables from information_schema ## 2. 系统表 -* 名称:`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`(详细介绍见后面小节) +* 名称:`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`(详细介绍见后面小节) * 操作:只读,只支持`SELECT`, `COUNT/SHOW DEVICES`, `DESC`,不支持对于表结构 / 内容的任意修改,如果修改将会报错:`"The database 'information_schema' can only be queried"` * 列名:系统表的列名均默认为小写,且用`_`分隔 @@ -708,6 +709,82 @@ IoTDB> select * from information_schema.services +------------+-----------+-------+ ``` +##### 2.22 TABLE_DISK_USAGE 表 + +> 该系统表从 V 2.0.9 版本开始提供 + +用于展示指定表(不包含 view)的磁盘空间占用情况,包括 ChunkGroup 的大小和 Metadata 大小。 + +注意:统计基于 TsFile 中数据的真实大小,因此不会考虑 mods 删除的情况。 + +表结构如下表所示: + +| 列名 | 数据类型 | 列类型 | 说明 | +| ----------------- | ---------- | -------- | -------------------- | +| database | string | Field | Database 名 | +| table\_name | string | Field | 表名 | +| datanode\_id | int32 | Field | DataNode 节点 id | +| region\_id | int32 | Field | Region id | +| time\_partition | int64 | Field | 时间分区 id | +| size\_in\_bytes | int64 | Field | 占用磁盘空间(byte) | + +查询示例: + +```SQL +-- 查询所有数据; +select * from information_schema.table_disk_usage; +``` + +```Bash ++---------+-------------------+-----------+---------+--------------+-------------+ +| database| table_name|datanode_id|region_id|time_partition|size_in_bytes| ++---------+-------------------+-----------+---------+--------------+-------------+ +|database1| table1| 1| 3| 2864| 867| +|database1| table11| 1| 3| 2864| 0| +|database1| table3| 1| 3| 2864| 0| +|database1| table1| 1| 3| 2865| 1411| +|database1| table11| 1| 3| 2865| 0| +|database1| table3| 1| 3| 2865| 0| +|database1| table1| 1| 3| 2925| 590| +|database1| table11| 1| 3| 2925| 0| +|database1| table3| 1| 3| 2925| 0| +|database1| table1| 1| 4| 2864| 883| +|database1| table11| 1| 4| 2864| 0| +|database1| table3| 1| 4| 2864| 0| +|database1| table1| 1| 4| 2865| 1224| +|database1| table11| 1| 4| 2865| 0| +|database1| table3| 1| 4| 2865| 0| +|database1| table1| 1| 4| 2888| 0| +|database1| table11| 1| 4| 2888| 0| +|database1| table3| 1| 4| 2888| 205| +| etth| tab_cov_forecast| 1| 8| 0| 0| +| etth| tab_real| 1| 8| 0| 963| +| etth|tab_target_forecast| 1| 8| 0| 0| +| etth| tab_cov_forecast| 1| 9| 0| 448| +| etth| tab_real| 1| 9| 0| 0| +| etth|tab_target_forecast| 1| 9| 0| 0| ++---------+-------------------+-----------+---------+--------------+-------------+ +``` + +```SQL +-- 指定查询条件; +select * from information_schema.table_disk_usage where region_id = 4 and table_name like '%1'; +``` + +```Bash ++---------+----------+-----------+---------+--------------+-------------+ +| database|table_name|datanode_id|region_id|time_partition|size_in_bytes| ++---------+----------+-----------+---------+--------------+-------------+ +|database1| table1| 1| 4| 2864| 883| +|database1| table11| 1| 4| 2864| 0| +|database1| table1| 1| 4| 2865| 1224| +|database1| table11| 1| 4| 2865| 0| +|database1| table1| 1| 4| 2888| 0| +|database1| table11| 1| 4| 2888| 0| ++---------+----------+-----------+---------+--------------+-------------+ +``` + + ## 3. 权限说明 * 不支持通过`GRANT/REVOKE`语句对 `information_schema` 数据库及其下任何表进行权限操作 diff --git a/src/zh/UserGuide/latest/User-Manual/Maintenance-statement_apache.md b/src/zh/UserGuide/latest/User-Manual/Maintenance-statement_apache.md index 012236f2f..10f7aea21 100644 --- a/src/zh/UserGuide/latest/User-Manual/Maintenance-statement_apache.md +++ b/src/zh/UserGuide/latest/User-Manual/Maintenance-statement_apache.md @@ -306,6 +306,57 @@ IoTDB> SHOW SERVICES ON 1 +------------+-----------+-------+ ``` +### 1.9 查看磁盘空间占用情况 + +含义:返回指定 pattern 的磁盘空间占用情况,包括 ChunkGroup 的大小和 Metadata 大小。 + +注意:统计基于 TsFile 中数据的真实大小,因此不会考虑 mods 删除的情况。 + +> V2.0.9-beta 起支持该功能 + +#### 语法: + +```SQL +showDiskUsageStatement + : SHOW DISK_USAGE FROM pathPattern + whereClause? + orderByClause? + rowPaginationClause? + ; +pathPattern + : ROOT (DOT nodeName)* + ; +``` + +说明:Pattern 用于匹配设备,需要使用 root 作为开头,路径的中间节点支持 * 或 **。 + +#### 结果集 + +| 列名 | 列类型 | 含义 | +| --------------- | -------- | -------------------- | +| Database | string | Database 名 | +| DataNodeId | int32 | DataNode 节点 id | +| RegionId | int32 | Region id | +| TimePartition | int64 | 时间分区 id | +| SizeInBytes | int64 | 占用磁盘空间(byte) | + +#### 示例: + +```SQL +SHOW DISK_USAGE FROM root.ln.**; +``` + +执行结果如下: + +```Bash ++--------+----------+--------+-------------+-----------+ +|Database|DataNodeId|RegionId|TimePartition|SizeInBytes| ++--------+----------+--------+-------------+-----------+ +| root.ln| 1| 13| 2932| 203| ++--------+----------+--------+-------------+-----------+ +``` + + ## 2. 状态设置 ### 2.1 设置连接的模型 diff --git a/src/zh/UserGuide/latest/User-Manual/Maintenance-statement_timecho.md b/src/zh/UserGuide/latest/User-Manual/Maintenance-statement_timecho.md index c5b369ca7..dc592f168 100644 --- a/src/zh/UserGuide/latest/User-Manual/Maintenance-statement_timecho.md +++ b/src/zh/UserGuide/latest/User-Manual/Maintenance-statement_timecho.md @@ -306,6 +306,59 @@ IoTDB> SHOW SERVICES ON 1 +------------+-----------+-------+ ``` + +### 1.9 查看磁盘空间占用情况 + +含义:返回指定 pattern 的磁盘空间占用情况,包括 ChunkGroup 的大小和 Metadata 大小。 + +注意:统计基于 TsFile 中数据的真实大小,因此不会考虑 mods 删除的情况。 + +> V2.0.9 起支持该功能 + +#### 语法: + +```SQL +showDiskUsageStatement + : SHOW DISK_USAGE FROM pathPattern + whereClause? + orderByClause? + rowPaginationClause? + ; +pathPattern + : ROOT (DOT nodeName)* + ; +``` + +说明:Pattern 用于匹配设备,需要使用 root 作为开头,路径的中间节点支持 * 或 **。 + +#### 结果集 + +| 列名 | 列类型 | 含义 | +| --------------- | -------- | -------------------- | +| Database | string | Database 名 | +| DataNodeId | int32 | DataNode 节点 id | +| RegionId | int32 | Region id | +| TimePartition | int64 | 时间分区 id | +| SizeInBytes | int64 | 占用磁盘空间(byte) | + +#### 示例: + +```SQL +SHOW DISK_USAGE FROM root.ln.**; +``` + +执行结果如下: + +```Bash ++--------+----------+--------+-------------+-----------+ +|Database|DataNodeId|RegionId|TimePartition|SizeInBytes| ++--------+----------+--------+-------------+-----------+ +| root.ln| 1| 13| 2932| 203| ++--------+----------+--------+-------------+-----------+ +``` + + + ## 2. 状态设置 ### 2.1 设置连接的模型