diff --git a/src/UserGuide/Master/Table/Reference/System-Config-Manual.md b/src/UserGuide/Master/Table/Reference/System-Config-Manual.md index 8b19fefd0..61778cfaf 100644 --- a/src/UserGuide/Master/Table/Reference/System-Config-Manual.md +++ b/src/UserGuide/Master/Table/Reference/System-Config-Manual.md @@ -1538,6 +1538,15 @@ The `iotdb-system.properties` file contains various configurations for managing | Default | 10000 | | Effective | Hot reload | +- query_cost_stat_window + +| Name | query_cost_stat_window | +|-------------|--------------------| +| Description | Time window threshold(min) for record of history queries. | +| Type | Int32 | +| Default | 0 | +| Effective | Hot reload | + - query_timeout_threshold | Name | query_timeout_threshold | diff --git a/src/UserGuide/Master/Table/Reference/System-Tables_apache.md b/src/UserGuide/Master/Table/Reference/System-Tables_apache.md index 2f914109d..2aa05d9fd 100644 --- a/src/UserGuide/Master/Table/Reference/System-Tables_apache.md +++ b/src/UserGuide/Master/Table/Reference/System-Tables_apache.md @@ -39,32 +39,34 @@ IoTDB> show databases +------------------+-------+-----------------------+---------------------+---------------------+ IoTDB> show tables from information_schema -+--------------+-------+ -| TableName|TTL(ms)| -+--------------+-------+ -| columns| INF| -| config_nodes| INF| -|configurations| INF| -| data_nodes| INF| -| databases| INF| -| functions| INF| -| keywords| INF| -| models| INF| -| nodes| INF| -| pipe_plugins| INF| -| pipes| INF| -| queries| INF| -| regions| INF| -| subscriptions| INF| -| tables| INF| -| topics| INF| -| views| INF| -+--------------+-------+ ++-----------------------+-------+ +| TableName|TTL(ms)| ++-----------------------+-------+ +| columns| INF| +| config_nodes| INF| +| configurations| INF| +| connections| INF| +| current_queries| INF| +| data_nodes| INF| +| databases| INF| +| functions| INF| +| keywords| INF| +| nodes| INF| +| pipe_plugins| INF| +| pipes| INF| +| queries| INF| +|queries_costs_histogram| INF| +| regions| INF| +| subscriptions| INF| +| tables| INF| +| topics| INF| +| views| INF| ++-----------------------+-------+ ``` ## 2. System Tables -* ​**Names**​: `DATABASES`, `TABLES`, `REGIONS`, `QUERIES`, `COLUMNS`, `PIPES`, `PIPE_PLUGINS`, `SUBSCRIPTION`, `TOPICS`, `VIEWS`, `MODELS`, `FUNCTIONS`, `CONFIGURATIONS`, `KEYWORDS`, `NODES`, `CONFIG_NODES`, `DATA_NODES` (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` (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 (`_`). @@ -369,7 +371,7 @@ IoTDB> select * from information_schema.views ### 2.11 MODELS Table -> This system table is available starting from version V2.0.5. +> This system table is available starting from version V 2.0.5 and has been discontinued since version V 2.0.8. * Contains information about all models in the database. * The table structure is as follows: @@ -592,6 +594,99 @@ IoTDB> select * from information_schema.data_nodes +-------+---------------+-----------------+-----------+--------+--------+-------------------+---------------------+ ``` +### 2.18 CONNECTIONS Table + +> This system table is available starting from version V 2.0.8 + +* Contains all connections in the cluster. +* The table structure is as follows: + +| **Column Name** | **Data Type** | **Column Type** | **Description** | +|-----------------|---------------|-----------------|------------------------| +| datanode_id | STRING | TAG | DataNode ID | +| user_id | STRING | TAG | User ID | +| session_id | STRING | TAG | Session ID | +| user_name | STRING | ATTRIBUTE | Username | +| last_active_time| TIMESTAMP | ATTRIBUTE | Last active time | +| client_ip | STRING | ATTRIBUTE | Client IP address | + +* Query example: + +```SQL +IoTDB> select * from information_schema.connections; ++-----------+-------+----------+---------+-----------------------------+---------+ +|datanode_id|user_id|session_id|user_name| last_active_time|client_ip| ++-----------+-------+----------+---------+-----------------------------+---------+ +| 1| 0| 2| root|2026-01-21T16:28:54.704+08:00|127.0.0.1| ++-----------+-------+----------+---------+-----------------------------+---------+ +``` + +### 2.19 CURRENT_QUERIES Table + +> This system table is available starting from version V 2.0.8 + +* Contains all queries whose execution end time falls within the range `[now() - query_cost_stat_window, now())`, including currently executing queries. The `query_cost_stat_window` parameter represents the query cost statistics window. Its default value is 0 and can be configured via the `iotdb-system.properties` configuration file. +* The table structure is as follows: + +| Column Name | Data Type | Column Type | Description | +|--------------|-----------|-------------|-----------------------------------------------------------------------------| +| query_id | STRING | TAG | Query statement ID | +| state | STRING | FIELD | Query state: RUNNING indicates executing, FINISHED indicates completed | +| start_time | TIMESTAMP | FIELD | Query start timestamp (precision matches system timestamp precision) | +| end_time | TIMESTAMP | FIELD | Query end timestamp (precision matches system timestamp precision). NULL if query is not yet finished | +| datanode_id | INT32 | FIELD | DataNode from which the query was initiated | +| cost_time | FLOAT | FIELD | Query execution time in seconds. If query is not finished, shows elapsed time | +| statement | STRING | FIELD | Query SQL / concatenated query request SQL | +| user | STRING | FIELD | User who initiated the query | +| client_ip | STRING | FIELD | Client IP address that initiated the query | + +* Regular users can only view their own queries; administrators can view all queries. +* Query example: + +```SQL +IoTDB> select * from information_schema.current_queries; ++-----------------------+-------+-----------------------------+--------+-----------+---------+------------------------------------------------+----+---------+ +| query_id| state| start_time|end_time|datanode_id|cost_time| statement|user|client_ip| ++-----------------------+-------+-----------------------------+--------+-----------+---------+------------------------------------------------+----+---------+ +|20260121_085427_00013_1|RUNNING|2026-01-21T16:54:27.019+08:00| null| 1| 0.0|select * from information_schema.current_queries|root|127.0.0.1| ++-----------------------+-------+-----------------------------+--------+-----------+---------+------------------------------------------------+----+---------+ +``` + +### 2.20 QUERIES_COSTS_HISTOGRAM Table + +> This system table is available starting from version V 2.0.8 + +* Contains a histogram of query execution times within the past `query_cost_stat_window` period (only statistics for completed SQL queries). The `query_cost_stat_window` parameter represents the query cost statistics window. Its default value is 0 and can be configured via the `iotdb-system.properties` configuration file. +* The table structure is as follows: + +| Column Name | Data Type | Column Type | Description | +|--------------|-----------|-------------|-----------------------------------------------------------------------------| +| bin | STRING | TAG | Bucket name: 61 buckets total - [0, 1), [1, 2), [2, 3), ..., [59, 60), 60+ | +| nums | INT32 | FIELD | Number of SQL queries in the bucket | +| datanode_id | INT32 | FIELD | DataNode to which this bucket belongs | + +* Only administrators can execute operations on this table. +* Query example: + +```SQL +IoTDB> select * from information_schema.queries_costs_histogram limit 10 ++------+----+-----------+ +| bin|nums|datanode_id| ++------+----+-----------+ +| [0,1)| 0| 1| +| [1,2)| 0| 1| +| [2,3)| 0| 1| +| [3,4)| 0| 1| +| [4,5)| 0| 1| +| [5,6)| 0| 1| +| [6,7)| 0| 1| +| [7,8)| 0| 1| +| [8,9)| 0| 1| +|[9,10)| 0| 1| ++------+----+-----------+ +``` + + ## 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 a680e0ebd..7bb37e58c 100644 --- a/src/UserGuide/Master/Table/Reference/System-Tables_timecho.md +++ b/src/UserGuide/Master/Table/Reference/System-Tables_timecho.md @@ -39,32 +39,34 @@ IoTDB> show databases +------------------+-------+-----------------------+---------------------+---------------------+ IoTDB> show tables from information_schema -+--------------+-------+ -| TableName|TTL(ms)| -+--------------+-------+ -| columns| INF| -| config_nodes| INF| -|configurations| INF| -| data_nodes| INF| -| databases| INF| -| functions| INF| -| keywords| INF| -| models| INF| -| nodes| INF| -| pipe_plugins| INF| -| pipes| INF| -| queries| INF| -| regions| INF| -| subscriptions| INF| -| tables| INF| -| topics| INF| -| views| INF| -+--------------+-------+ ++-----------------------+-------+ +| TableName|TTL(ms)| ++-----------------------+-------+ +| columns| INF| +| config_nodes| INF| +| configurations| INF| +| connections| INF| +| current_queries| INF| +| data_nodes| INF| +| databases| INF| +| functions| INF| +| keywords| INF| +| nodes| INF| +| pipe_plugins| INF| +| pipes| INF| +| queries| INF| +|queries_costs_histogram| INF| +| regions| INF| +| subscriptions| INF| +| tables| INF| +| topics| INF| +| views| INF| ++-----------------------+-------+ ``` ## 2. System Tables -* ​**Names**​: `DATABASES`, `TABLES`, `REGIONS`, `QUERIES`, `COLUMNS`, `PIPES`, `PIPE_PLUGINS`, `SUBSCRIPTION`, `TOPICS`, `VIEWS`, `MODELS`, `FUNCTIONS`, `CONFIGURATIONS`, `KEYWORDS`, `NODES`, `CONFIG_NODES`, `DATA_NODES` (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` (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 (`_`). @@ -369,7 +371,7 @@ IoTDB> select * from information_schema.views ### 2.11 MODELS Table -> This system table is available starting from version V2.0.5. +> This system table is available starting from version V 2.0.5 and has been discontinued since version V 2.0.8. * Contains information about all models in the database. * The table structure is as follows: @@ -592,6 +594,99 @@ IoTDB> select * from information_schema.data_nodes +-------+---------------+-----------------+-----------+--------+--------+-------------------+---------------------+ ``` +### 2.18 CONNECTIONS Table + +> This system table is available starting from version V 2.0.8 + +* Contains all connections in the cluster. +* The table structure is as follows: + +| **Column Name** | **Data Type** | **Column Type** | **Description** | +|-----------------|---------------|-----------------|------------------------| +| datanode_id | STRING | TAG | DataNode ID | +| user_id | STRING | TAG | User ID | +| session_id | STRING | TAG | Session ID | +| user_name | STRING | ATTRIBUTE | Username | +| last_active_time| TIMESTAMP | ATTRIBUTE | Last active time | +| client_ip | STRING | ATTRIBUTE | Client IP address | + +* Query example: + +```SQL +IoTDB> select * from information_schema.connections; ++-----------+-------+----------+---------+-----------------------------+---------+ +|datanode_id|user_id|session_id|user_name| last_active_time|client_ip| ++-----------+-------+----------+---------+-----------------------------+---------+ +| 1| 0| 2| root|2026-01-21T16:28:54.704+08:00|127.0.0.1| ++-----------+-------+----------+---------+-----------------------------+---------+ +``` + +### 2.19 CURRENT_QUERIES Table + +> This system table is available starting from version V 2.0.8 + +* Contains all queries whose execution end time falls within the range `[now() - query_cost_stat_window, now())`, including currently executing queries. The `query_cost_stat_window` parameter represents the query cost statistics window. Its default value is 0 and can be configured via the `iotdb-system.properties` configuration file. +* The table structure is as follows: + +| Column Name | Data Type | Column Type | Description | +|--------------|-----------|-------------|-----------------------------------------------------------------------------| +| query_id | STRING | TAG | Query statement ID | +| state | STRING | FIELD | Query state: RUNNING indicates executing, FINISHED indicates completed | +| start_time | TIMESTAMP | FIELD | Query start timestamp (precision matches system timestamp precision) | +| end_time | TIMESTAMP | FIELD | Query end timestamp (precision matches system timestamp precision). NULL if query is not yet finished | +| datanode_id | INT32 | FIELD | DataNode from which the query was initiated | +| cost_time | FLOAT | FIELD | Query execution time in seconds. If query is not finished, shows elapsed time | +| statement | STRING | FIELD | Query SQL / concatenated query request SQL | +| user | STRING | FIELD | User who initiated the query | +| client_ip | STRING | FIELD | Client IP address that initiated the query | + +* Regular users can only view their own queries; administrators can view all queries. +* Query example: + +```SQL +IoTDB> select * from information_schema.current_queries; ++-----------------------+-------+-----------------------------+--------+-----------+---------+------------------------------------------------+----+---------+ +| query_id| state| start_time|end_time|datanode_id|cost_time| statement|user|client_ip| ++-----------------------+-------+-----------------------------+--------+-----------+---------+------------------------------------------------+----+---------+ +|20260121_085427_00013_1|RUNNING|2026-01-21T16:54:27.019+08:00| null| 1| 0.0|select * from information_schema.current_queries|root|127.0.0.1| ++-----------------------+-------+-----------------------------+--------+-----------+---------+------------------------------------------------+----+---------+ +``` + +### 2.20 QUERIES_COSTS_HISTOGRAM Table + +> This system table is available starting from version V 2.0.8 + +* Contains a histogram of query execution times within the past `query_cost_stat_window` period (only statistics for completed SQL queries). The `query_cost_stat_window` parameter represents the query cost statistics window. Its default value is 0 and can be configured via the `iotdb-system.properties` configuration file. +* The table structure is as follows: + +| Column Name | Data Type | Column Type | Description | +|--------------|-----------|-------------|-----------------------------------------------------------------------------| +| bin | STRING | TAG | Bucket name: 61 buckets total - [0, 1), [1, 2), [2, 3), ..., [59, 60), 60+ | +| nums | INT32 | FIELD | Number of SQL queries in the bucket | +| datanode_id | INT32 | FIELD | DataNode to which this bucket belongs | + +* Only administrators can execute operations on this table. +* Query example: + +```SQL +IoTDB> select * from information_schema.queries_costs_histogram limit 10 ++------+----+-----------+ +| bin|nums|datanode_id| ++------+----+-----------+ +| [0,1)| 0| 1| +| [1,2)| 0| 1| +| [2,3)| 0| 1| +| [3,4)| 0| 1| +| [4,5)| 0| 1| +| [5,6)| 0| 1| +| [6,7)| 0| 1| +| [7,8)| 0| 1| +| [8,9)| 0| 1| +|[9,10)| 0| 1| ++------+----+-----------+ +``` + + ## 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-Config-Manual.md b/src/UserGuide/latest-Table/Reference/System-Config-Manual.md index 8b19fefd0..61778cfaf 100644 --- a/src/UserGuide/latest-Table/Reference/System-Config-Manual.md +++ b/src/UserGuide/latest-Table/Reference/System-Config-Manual.md @@ -1538,6 +1538,15 @@ The `iotdb-system.properties` file contains various configurations for managing | Default | 10000 | | Effective | Hot reload | +- query_cost_stat_window + +| Name | query_cost_stat_window | +|-------------|--------------------| +| Description | Time window threshold(min) for record of history queries. | +| Type | Int32 | +| Default | 0 | +| Effective | Hot reload | + - query_timeout_threshold | Name | query_timeout_threshold | diff --git a/src/UserGuide/latest-Table/Reference/System-Tables_apache.md b/src/UserGuide/latest-Table/Reference/System-Tables_apache.md index 2f914109d..2aa05d9fd 100644 --- a/src/UserGuide/latest-Table/Reference/System-Tables_apache.md +++ b/src/UserGuide/latest-Table/Reference/System-Tables_apache.md @@ -39,32 +39,34 @@ IoTDB> show databases +------------------+-------+-----------------------+---------------------+---------------------+ IoTDB> show tables from information_schema -+--------------+-------+ -| TableName|TTL(ms)| -+--------------+-------+ -| columns| INF| -| config_nodes| INF| -|configurations| INF| -| data_nodes| INF| -| databases| INF| -| functions| INF| -| keywords| INF| -| models| INF| -| nodes| INF| -| pipe_plugins| INF| -| pipes| INF| -| queries| INF| -| regions| INF| -| subscriptions| INF| -| tables| INF| -| topics| INF| -| views| INF| -+--------------+-------+ ++-----------------------+-------+ +| TableName|TTL(ms)| ++-----------------------+-------+ +| columns| INF| +| config_nodes| INF| +| configurations| INF| +| connections| INF| +| current_queries| INF| +| data_nodes| INF| +| databases| INF| +| functions| INF| +| keywords| INF| +| nodes| INF| +| pipe_plugins| INF| +| pipes| INF| +| queries| INF| +|queries_costs_histogram| INF| +| regions| INF| +| subscriptions| INF| +| tables| INF| +| topics| INF| +| views| INF| ++-----------------------+-------+ ``` ## 2. System Tables -* ​**Names**​: `DATABASES`, `TABLES`, `REGIONS`, `QUERIES`, `COLUMNS`, `PIPES`, `PIPE_PLUGINS`, `SUBSCRIPTION`, `TOPICS`, `VIEWS`, `MODELS`, `FUNCTIONS`, `CONFIGURATIONS`, `KEYWORDS`, `NODES`, `CONFIG_NODES`, `DATA_NODES` (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` (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 (`_`). @@ -369,7 +371,7 @@ IoTDB> select * from information_schema.views ### 2.11 MODELS Table -> This system table is available starting from version V2.0.5. +> This system table is available starting from version V 2.0.5 and has been discontinued since version V 2.0.8. * Contains information about all models in the database. * The table structure is as follows: @@ -592,6 +594,99 @@ IoTDB> select * from information_schema.data_nodes +-------+---------------+-----------------+-----------+--------+--------+-------------------+---------------------+ ``` +### 2.18 CONNECTIONS Table + +> This system table is available starting from version V 2.0.8 + +* Contains all connections in the cluster. +* The table structure is as follows: + +| **Column Name** | **Data Type** | **Column Type** | **Description** | +|-----------------|---------------|-----------------|------------------------| +| datanode_id | STRING | TAG | DataNode ID | +| user_id | STRING | TAG | User ID | +| session_id | STRING | TAG | Session ID | +| user_name | STRING | ATTRIBUTE | Username | +| last_active_time| TIMESTAMP | ATTRIBUTE | Last active time | +| client_ip | STRING | ATTRIBUTE | Client IP address | + +* Query example: + +```SQL +IoTDB> select * from information_schema.connections; ++-----------+-------+----------+---------+-----------------------------+---------+ +|datanode_id|user_id|session_id|user_name| last_active_time|client_ip| ++-----------+-------+----------+---------+-----------------------------+---------+ +| 1| 0| 2| root|2026-01-21T16:28:54.704+08:00|127.0.0.1| ++-----------+-------+----------+---------+-----------------------------+---------+ +``` + +### 2.19 CURRENT_QUERIES Table + +> This system table is available starting from version V 2.0.8 + +* Contains all queries whose execution end time falls within the range `[now() - query_cost_stat_window, now())`, including currently executing queries. The `query_cost_stat_window` parameter represents the query cost statistics window. Its default value is 0 and can be configured via the `iotdb-system.properties` configuration file. +* The table structure is as follows: + +| Column Name | Data Type | Column Type | Description | +|--------------|-----------|-------------|-----------------------------------------------------------------------------| +| query_id | STRING | TAG | Query statement ID | +| state | STRING | FIELD | Query state: RUNNING indicates executing, FINISHED indicates completed | +| start_time | TIMESTAMP | FIELD | Query start timestamp (precision matches system timestamp precision) | +| end_time | TIMESTAMP | FIELD | Query end timestamp (precision matches system timestamp precision). NULL if query is not yet finished | +| datanode_id | INT32 | FIELD | DataNode from which the query was initiated | +| cost_time | FLOAT | FIELD | Query execution time in seconds. If query is not finished, shows elapsed time | +| statement | STRING | FIELD | Query SQL / concatenated query request SQL | +| user | STRING | FIELD | User who initiated the query | +| client_ip | STRING | FIELD | Client IP address that initiated the query | + +* Regular users can only view their own queries; administrators can view all queries. +* Query example: + +```SQL +IoTDB> select * from information_schema.current_queries; ++-----------------------+-------+-----------------------------+--------+-----------+---------+------------------------------------------------+----+---------+ +| query_id| state| start_time|end_time|datanode_id|cost_time| statement|user|client_ip| ++-----------------------+-------+-----------------------------+--------+-----------+---------+------------------------------------------------+----+---------+ +|20260121_085427_00013_1|RUNNING|2026-01-21T16:54:27.019+08:00| null| 1| 0.0|select * from information_schema.current_queries|root|127.0.0.1| ++-----------------------+-------+-----------------------------+--------+-----------+---------+------------------------------------------------+----+---------+ +``` + +### 2.20 QUERIES_COSTS_HISTOGRAM Table + +> This system table is available starting from version V 2.0.8 + +* Contains a histogram of query execution times within the past `query_cost_stat_window` period (only statistics for completed SQL queries). The `query_cost_stat_window` parameter represents the query cost statistics window. Its default value is 0 and can be configured via the `iotdb-system.properties` configuration file. +* The table structure is as follows: + +| Column Name | Data Type | Column Type | Description | +|--------------|-----------|-------------|-----------------------------------------------------------------------------| +| bin | STRING | TAG | Bucket name: 61 buckets total - [0, 1), [1, 2), [2, 3), ..., [59, 60), 60+ | +| nums | INT32 | FIELD | Number of SQL queries in the bucket | +| datanode_id | INT32 | FIELD | DataNode to which this bucket belongs | + +* Only administrators can execute operations on this table. +* Query example: + +```SQL +IoTDB> select * from information_schema.queries_costs_histogram limit 10 ++------+----+-----------+ +| bin|nums|datanode_id| ++------+----+-----------+ +| [0,1)| 0| 1| +| [1,2)| 0| 1| +| [2,3)| 0| 1| +| [3,4)| 0| 1| +| [4,5)| 0| 1| +| [5,6)| 0| 1| +| [6,7)| 0| 1| +| [7,8)| 0| 1| +| [8,9)| 0| 1| +|[9,10)| 0| 1| ++------+----+-----------+ +``` + + ## 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 a680e0ebd..7bb37e58c 100644 --- a/src/UserGuide/latest-Table/Reference/System-Tables_timecho.md +++ b/src/UserGuide/latest-Table/Reference/System-Tables_timecho.md @@ -39,32 +39,34 @@ IoTDB> show databases +------------------+-------+-----------------------+---------------------+---------------------+ IoTDB> show tables from information_schema -+--------------+-------+ -| TableName|TTL(ms)| -+--------------+-------+ -| columns| INF| -| config_nodes| INF| -|configurations| INF| -| data_nodes| INF| -| databases| INF| -| functions| INF| -| keywords| INF| -| models| INF| -| nodes| INF| -| pipe_plugins| INF| -| pipes| INF| -| queries| INF| -| regions| INF| -| subscriptions| INF| -| tables| INF| -| topics| INF| -| views| INF| -+--------------+-------+ ++-----------------------+-------+ +| TableName|TTL(ms)| ++-----------------------+-------+ +| columns| INF| +| config_nodes| INF| +| configurations| INF| +| connections| INF| +| current_queries| INF| +| data_nodes| INF| +| databases| INF| +| functions| INF| +| keywords| INF| +| nodes| INF| +| pipe_plugins| INF| +| pipes| INF| +| queries| INF| +|queries_costs_histogram| INF| +| regions| INF| +| subscriptions| INF| +| tables| INF| +| topics| INF| +| views| INF| ++-----------------------+-------+ ``` ## 2. System Tables -* ​**Names**​: `DATABASES`, `TABLES`, `REGIONS`, `QUERIES`, `COLUMNS`, `PIPES`, `PIPE_PLUGINS`, `SUBSCRIPTION`, `TOPICS`, `VIEWS`, `MODELS`, `FUNCTIONS`, `CONFIGURATIONS`, `KEYWORDS`, `NODES`, `CONFIG_NODES`, `DATA_NODES` (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` (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 (`_`). @@ -369,7 +371,7 @@ IoTDB> select * from information_schema.views ### 2.11 MODELS Table -> This system table is available starting from version V2.0.5. +> This system table is available starting from version V 2.0.5 and has been discontinued since version V 2.0.8. * Contains information about all models in the database. * The table structure is as follows: @@ -592,6 +594,99 @@ IoTDB> select * from information_schema.data_nodes +-------+---------------+-----------------+-----------+--------+--------+-------------------+---------------------+ ``` +### 2.18 CONNECTIONS Table + +> This system table is available starting from version V 2.0.8 + +* Contains all connections in the cluster. +* The table structure is as follows: + +| **Column Name** | **Data Type** | **Column Type** | **Description** | +|-----------------|---------------|-----------------|------------------------| +| datanode_id | STRING | TAG | DataNode ID | +| user_id | STRING | TAG | User ID | +| session_id | STRING | TAG | Session ID | +| user_name | STRING | ATTRIBUTE | Username | +| last_active_time| TIMESTAMP | ATTRIBUTE | Last active time | +| client_ip | STRING | ATTRIBUTE | Client IP address | + +* Query example: + +```SQL +IoTDB> select * from information_schema.connections; ++-----------+-------+----------+---------+-----------------------------+---------+ +|datanode_id|user_id|session_id|user_name| last_active_time|client_ip| ++-----------+-------+----------+---------+-----------------------------+---------+ +| 1| 0| 2| root|2026-01-21T16:28:54.704+08:00|127.0.0.1| ++-----------+-------+----------+---------+-----------------------------+---------+ +``` + +### 2.19 CURRENT_QUERIES Table + +> This system table is available starting from version V 2.0.8 + +* Contains all queries whose execution end time falls within the range `[now() - query_cost_stat_window, now())`, including currently executing queries. The `query_cost_stat_window` parameter represents the query cost statistics window. Its default value is 0 and can be configured via the `iotdb-system.properties` configuration file. +* The table structure is as follows: + +| Column Name | Data Type | Column Type | Description | +|--------------|-----------|-------------|-----------------------------------------------------------------------------| +| query_id | STRING | TAG | Query statement ID | +| state | STRING | FIELD | Query state: RUNNING indicates executing, FINISHED indicates completed | +| start_time | TIMESTAMP | FIELD | Query start timestamp (precision matches system timestamp precision) | +| end_time | TIMESTAMP | FIELD | Query end timestamp (precision matches system timestamp precision). NULL if query is not yet finished | +| datanode_id | INT32 | FIELD | DataNode from which the query was initiated | +| cost_time | FLOAT | FIELD | Query execution time in seconds. If query is not finished, shows elapsed time | +| statement | STRING | FIELD | Query SQL / concatenated query request SQL | +| user | STRING | FIELD | User who initiated the query | +| client_ip | STRING | FIELD | Client IP address that initiated the query | + +* Regular users can only view their own queries; administrators can view all queries. +* Query example: + +```SQL +IoTDB> select * from information_schema.current_queries; ++-----------------------+-------+-----------------------------+--------+-----------+---------+------------------------------------------------+----+---------+ +| query_id| state| start_time|end_time|datanode_id|cost_time| statement|user|client_ip| ++-----------------------+-------+-----------------------------+--------+-----------+---------+------------------------------------------------+----+---------+ +|20260121_085427_00013_1|RUNNING|2026-01-21T16:54:27.019+08:00| null| 1| 0.0|select * from information_schema.current_queries|root|127.0.0.1| ++-----------------------+-------+-----------------------------+--------+-----------+---------+------------------------------------------------+----+---------+ +``` + +### 2.20 QUERIES_COSTS_HISTOGRAM Table + +> This system table is available starting from version V 2.0.8 + +* Contains a histogram of query execution times within the past `query_cost_stat_window` period (only statistics for completed SQL queries). The `query_cost_stat_window` parameter represents the query cost statistics window. Its default value is 0 and can be configured via the `iotdb-system.properties` configuration file. +* The table structure is as follows: + +| Column Name | Data Type | Column Type | Description | +|--------------|-----------|-------------|-----------------------------------------------------------------------------| +| bin | STRING | TAG | Bucket name: 61 buckets total - [0, 1), [1, 2), [2, 3), ..., [59, 60), 60+ | +| nums | INT32 | FIELD | Number of SQL queries in the bucket | +| datanode_id | INT32 | FIELD | DataNode to which this bucket belongs | + +* Only administrators can execute operations on this table. +* Query example: + +```SQL +IoTDB> select * from information_schema.queries_costs_histogram limit 10 ++------+----+-----------+ +| bin|nums|datanode_id| ++------+----+-----------+ +| [0,1)| 0| 1| +| [1,2)| 0| 1| +| [2,3)| 0| 1| +| [3,4)| 0| 1| +| [4,5)| 0| 1| +| [5,6)| 0| 1| +| [6,7)| 0| 1| +| [7,8)| 0| 1| +| [8,9)| 0| 1| +|[9,10)| 0| 1| ++------+----+-----------+ +``` + + ## 3. Permission Description * GRANT/REVOKE operations are not supported for the `information_schema` database or any of its tables. diff --git a/src/zh/UserGuide/Master/Table/Reference/System-Config-Manual.md b/src/zh/UserGuide/Master/Table/Reference/System-Config-Manual.md index 86ee645c0..15473c00a 100644 --- a/src/zh/UserGuide/Master/Table/Reference/System-Config-Manual.md +++ b/src/zh/UserGuide/Master/Table/Reference/System-Config-Manual.md @@ -1515,6 +1515,15 @@ IoTDB 配置文件位于 IoTDB 安装目录:`conf`文件夹下。 | 默认值 | 10000 | | 改后生效方式 | 热加载 | +- query_cost_stat_window + +| 名字 | query_cost_stat_window | +| ------------ |--------------------| +| 描述 | 查询耗时统计的窗口,单位为分钟。 | +| 类型 | Int32 | +| 默认值 | 0 | +| 改后生效方式 | 热加载 | + - query_timeout_threshold | 名字 | query_timeout_threshold | 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 e0c594dc4..418b08f66 100644 --- a/src/zh/UserGuide/Master/Table/Reference/System-Tables_apache.md +++ b/src/zh/UserGuide/Master/Table/Reference/System-Tables_apache.md @@ -39,32 +39,34 @@ IoTDB> show databases +------------------+-------+-----------------------+---------------------+---------------------+ IoTDB> show tables from information_schema -+--------------+-------+ -| TableName|TTL(ms)| -+--------------+-------+ -| columns| INF| -| config_nodes| INF| -|configurations| INF| -| data_nodes| INF| -| databases| INF| -| functions| INF| -| keywords| INF| -| models| INF| -| nodes| INF| -| pipe_plugins| INF| -| pipes| INF| -| queries| INF| -| regions| INF| -| subscriptions| INF| -| tables| INF| -| topics| INF| -| views| INF| -+--------------+-------+ ++-----------------------+-------+ +| TableName|TTL(ms)| ++-----------------------+-------+ +| columns| INF| +| config_nodes| INF| +| configurations| INF| +| connections| INF| +| current_queries| INF| +| data_nodes| INF| +| databases| INF| +| functions| INF| +| keywords| INF| +| nodes| INF| +| pipe_plugins| INF| +| pipes| INF| +| queries| INF| +|queries_costs_histogram| INF| +| regions| INF| +| subscriptions| INF| +| tables| INF| +| topics| INF| +| views| INF| ++-----------------------+-------+ ``` ## 2. 系统表 -* 名称:`DATABASES`, `TABLES`, `REGIONS`, `QUERIES`, `COLUMNS`, `PIPES`, `PIPE_PLUGINS`, `SUBSCRIPTION`, `TOPICS`, `VIEWS`, `MODELS`, `FUNCTIONS`, `CONFIGURATIONS`, `KEYWORDS`, `NODES`, `CONFIG_NODES`, `DATA_NODES`(详细介绍见后面小节) +* 名称:`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`(详细介绍见后面小节) * 操作:只读,只支持`SELECT`, `COUNT/SHOW DEVICES`, `DESC`,不支持对于表结构 / 内容的任意修改,如果修改将会报错:`"The database 'information_schema' can only be queried"` * 列名:系统表的列名均默认为小写,且用`_`分隔 @@ -367,7 +369,7 @@ IoTDB> select * from information_schema.views ### 2.11 MODELS 表 -> 该系统表从 V 2.0.5 版本开始提供 +> 该系统表从 V 2.0.5 版本开始提供,从V 2.0.8 版本开始不再提供 * 包含数据库内所有的模型信息 * 表结构如下表所示: @@ -585,6 +587,98 @@ IoTDB> select * from information_schema.data_nodes +-------+---------------+-----------------+-----------+--------+--------+-------------------+---------------------+ ``` +### 2.18 CONNECTIONS 表 + +> 该系统表从 V 2.0.8 版本开始提供 + +* 包含集群中所有连接。 +* 表结构如下表所示: + +| **列名** | **数据类型** | **列类型** | **说明** | +| -------------------- | -------------------- | ------------------ | ---------------- | +| datanode\_id | STRING | TAG | DataNode的ID | +| user\_id | STRING | TAG | 用户ID | +| session\_id | STRING | TAG | Session ID | +| user\_name | STRING | ATTRIBUTE | 用户名 | +| last\_active\_time | TIMESTAMP | ATTRIBUTE | 最近活跃时间 | +| client\_ip | STRING | ATTRIBUTE | 客户端IP | + +* 查询示例: + +```SQL +IoTDB> select * from information_schema.connections; ++-----------+-------+----------+---------+-----------------------------+---------+ +|datanode_id|user_id|session_id|user_name| last_active_time|client_ip| ++-----------+-------+----------+---------+-----------------------------+---------+ +| 1| 0| 2| root|2026-01-21T16:28:54.704+08:00|127.0.0.1| ++-----------+-------+----------+---------+-----------------------------+---------+ +``` + +### 2.19 CURRENT\_QUERIES 表 + +> 该系统表从 V 2.0.8 版本开始提供 + +* 包含所有执行结束时间在 `[now() - query_cost_stat_window, now())` 范围内的所有查询,也包括当前正在执行的查询。其中`query_cost_stat_window `代表查询耗时统计的窗口,默认值为 0 ,可通过配置文件`iotdb-system.properties`进行配置。 +* 表结构如下表所示: + +| 列名 | 数据类型 | 列类型 | 说明 | +| -------------- | ----------- | -------- | ------------------------------------------------------------------------------- | +| query\_id | STRING | TAG | 查询语句的 ID | +| state | STRING | FIELD | 查询状态,RUNNING 表示正在执行,FINISHED 表示已结束 | +| start\_time | TIMESTAMP | FIELD | 查询开始的时间戳,时间戳精度与系统精度保持一致 | +| end\_time | TIMESTAMP | FIELD | 查询结束的时间戳,时间戳精度与系统精度保持一致。若查询尚未结束,该列值为 NULL | +| datanode\_id | INT32 | FIELD | 该查询语句是从哪个 DataNode 发起的 | +| cost\_time| FLOAT | FIELD | 查询的执行耗时,单位是秒。若查询尚未结束,该列值为查询已执行时间 | +| statement | STRING | FIELD | 查询的sql / 查询请求拼接后的 sql | +| user | STRING | FIELD | 发起查询的用户 | +| client\_ip | STRING | FIELD | 发起查询的客户端 ip | + +* 普通用户查询结果仅显示自身执行的查询;管理员显示全部。 +* 查询示例: + +```SQL +IoTDB> select * from information_schema.current_queries; ++-----------------------+-------+-----------------------------+--------+-----------+---------+------------------------------------------------+----+---------+ +| query_id| state| start_time|end_time|datanode_id|cost_time| statement|user|client_ip| ++-----------------------+-------+-----------------------------+--------+-----------+---------+------------------------------------------------+----+---------+ +|20260121_085427_00013_1|RUNNING|2026-01-21T16:54:27.019+08:00| null| 1| 0.0|select * from information_schema.current_queries|root|127.0.0.1| ++-----------------------+-------+-----------------------------+--------+-----------+---------+------------------------------------------------+----+---------+ +``` + +### 2.20 QUERIES\_COSTS\_HISTOGRAM 表 + +> 该系统表从 V 2.0.8 版本开始提供 + +* 包含过去 `query_cost_stat_window` 时间内的查询耗时的直方图(仅统计已经执行结束的 SQL),其中`query_cost_stat_window `代表查询耗时统计的窗口,默认值为 0 ,可通过配置文件`iotdb-system.properties`进行配置。 +* 表结构如下表所示: + +| 列名 | 数据类型 | 列类型 | 说明 | +| -------------- | ---------- | -------- | -------------------------------------------------------------------- | +| bin| STRING | TAG| 分桶名:共包含61个分桶,[0, 1), [1, 2), [2, 3),...., [59, 60), 60+ | +| nums | INT32 | FIELD | 分桶内sql的个数 | +| datanode\_id | INT32 | FIELD | 该桶属于哪个 DataNode | + +* 仅管理员可执行操作 +* 查询示例: + +```SQL +IoTDB> select * from information_schema.queries_costs_histogram limit 10 ++------+----+-----------+ +| bin|nums|datanode_id| ++------+----+-----------+ +| [0,1)| 0| 1| +| [1,2)| 0| 1| +| [2,3)| 0| 1| +| [3,4)| 0| 1| +| [4,5)| 0| 1| +| [5,6)| 0| 1| +| [6,7)| 0| 1| +| [7,8)| 0| 1| +| [8,9)| 0| 1| +|[9,10)| 0| 1| ++------+----+-----------+ +``` + ## 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 f0f2fec5b..e13fa2c59 100644 --- a/src/zh/UserGuide/Master/Table/Reference/System-Tables_timecho.md +++ b/src/zh/UserGuide/Master/Table/Reference/System-Tables_timecho.md @@ -39,32 +39,34 @@ IoTDB> show databases +------------------+-------+-----------------------+---------------------+---------------------+ IoTDB> show tables from information_schema -+--------------+-------+ -| TableName|TTL(ms)| -+--------------+-------+ -| columns| INF| -| config_nodes| INF| -|configurations| INF| -| data_nodes| INF| -| databases| INF| -| functions| INF| -| keywords| INF| -| models| INF| -| nodes| INF| -| pipe_plugins| INF| -| pipes| INF| -| queries| INF| -| regions| INF| -| subscriptions| INF| -| tables| INF| -| topics| INF| -| views| INF| -+--------------+-------+ ++-----------------------+-------+ +| TableName|TTL(ms)| ++-----------------------+-------+ +| columns| INF| +| config_nodes| INF| +| configurations| INF| +| connections| INF| +| current_queries| INF| +| data_nodes| INF| +| databases| INF| +| functions| INF| +| keywords| INF| +| nodes| INF| +| pipe_plugins| INF| +| pipes| INF| +| queries| INF| +|queries_costs_histogram| INF| +| regions| INF| +| subscriptions| INF| +| tables| INF| +| topics| INF| +| views| INF| ++-----------------------+-------+ ``` ## 2. 系统表 -* 名称:`DATABASES`, `TABLES`, `REGIONS`, `QUERIES`, `COLUMNS`, `PIPES`, `PIPE_PLUGINS`, `SUBSCRIPTION`, `TOPICS`, `VIEWS`, `MODELS`, `FUNCTIONS`, `CONFIGURATIONS`, `KEYWORDS`, `NODES`, `CONFIG_NODES`, `DATA_NODES`(详细介绍见后面小节) +* 名称:`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`(详细介绍见后面小节) * 操作:只读,只支持`SELECT`, `COUNT/SHOW DEVICES`, `DESC`,不支持对于表结构 / 内容的任意修改,如果修改将会报错:`"The database 'information_schema' can only be queried"` * 列名:系统表的列名均默认为小写,且用`_`分隔 @@ -367,7 +369,7 @@ IoTDB> select * from information_schema.views ### 2.11 MODELS 表 -> 该系统表从 V 2.0.5 版本开始提供 +> 该系统表从 V 2.0.5 版本开始提供,从V 2.0.8 版本开始不再提供 * 包含数据库内所有的模型信息 * 表结构如下表所示: @@ -585,6 +587,99 @@ IoTDB> select * from information_schema.data_nodes +-------+---------------+-----------------+-----------+--------+--------+-------------------+---------------------+ ``` +### 2.18 CONNECTIONS 表 + +> 该系统表从 V 2.0.8 版本开始提供 + +* 包含集群中所有连接。 +* 表结构如下表所示: + +| **列名** | **数据类型** | **列类型** | **说明** | +| -------------------- | -------------------- | ------------------ | ---------------- | +| datanode\_id | STRING | TAG | DataNode的ID | +| user\_id | STRING | TAG | 用户ID | +| session\_id | STRING | TAG | Session ID | +| user\_name | STRING | ATTRIBUTE | 用户名 | +| last\_active\_time | TIMESTAMP | ATTRIBUTE | 最近活跃时间 | +| client\_ip | STRING | ATTRIBUTE | 客户端IP | + +* 查询示例: + +```SQL +IoTDB> select * from information_schema.connections; ++-----------+-------+----------+---------+-----------------------------+---------+ +|datanode_id|user_id|session_id|user_name| last_active_time|client_ip| ++-----------+-------+----------+---------+-----------------------------+---------+ +| 1| 0| 2| root|2026-01-21T16:28:54.704+08:00|127.0.0.1| ++-----------+-------+----------+---------+-----------------------------+---------+ +``` + +### 2.19 CURRENT\_QUERIES 表 + +> 该系统表从 V 2.0.8 版本开始提供 + +* 包含所有执行结束时间在 `[now() - query_cost_stat_window, now())` 范围内的所有查询,也包括当前正在执行的查询。其中`query_cost_stat_window `代表查询耗时统计的窗口,默认值为 0 ,可通过配置文件`iotdb-system.properties`进行配置。 +* 表结构如下表所示: + +| 列名 | 数据类型 | 列类型 | 说明 | +| -------------- | ----------- | -------- | ------------------------------------------------------------------------------- | +| query\_id | STRING | TAG | 查询语句的 ID | +| state | STRING | FIELD | 查询状态,RUNNING 表示正在执行,FINISHED 表示已结束 | +| start\_time | TIMESTAMP | FIELD | 查询开始的时间戳,时间戳精度与系统精度保持一致 | +| end\_time | TIMESTAMP | FIELD | 查询结束的时间戳,时间戳精度与系统精度保持一致。若查询尚未结束,该列值为 NULL | +| datanode\_id | INT32 | FIELD | 该查询语句是从哪个 DataNode 发起的 | +| cost\_time| FLOAT | FIELD | 查询的执行耗时,单位是秒。若查询尚未结束,该列值为查询已执行时间 | +| statement | STRING | FIELD | 查询的sql / 查询请求拼接后的 sql | +| user | STRING | FIELD | 发起查询的用户 | +| client\_ip | STRING | FIELD | 发起查询的客户端 ip | + +* 普通用户查询结果仅显示自身执行的查询;管理员显示全部。 +* 查询示例: + +```SQL +IoTDB> select * from information_schema.current_queries; ++-----------------------+-------+-----------------------------+--------+-----------+---------+------------------------------------------------+----+---------+ +| query_id| state| start_time|end_time|datanode_id|cost_time| statement|user|client_ip| ++-----------------------+-------+-----------------------------+--------+-----------+---------+------------------------------------------------+----+---------+ +|20260121_085427_00013_1|RUNNING|2026-01-21T16:54:27.019+08:00| null| 1| 0.0|select * from information_schema.current_queries|root|127.0.0.1| ++-----------------------+-------+-----------------------------+--------+-----------+---------+------------------------------------------------+----+---------+ +``` + +### 2.20 QUERIES\_COSTS\_HISTOGRAM 表 + +> 该系统表从 V 2.0.8 版本开始提供 + +* 包含过去 `query_cost_stat_window` 时间内的查询耗时的直方图(仅统计已经执行结束的 SQL),其中`query_cost_stat_window `代表查询耗时统计的窗口,默认值为 0 ,可通过配置文件`iotdb-system.properties`进行配置。 +* 表结构如下表所示: + +| 列名 | 数据类型 | 列类型 | 说明 | +| -------------- | ---------- | -------- | -------------------------------------------------------------------- | +| bin| STRING | TAG| 分桶名:共包含61个分桶,[0, 1), [1, 2), [2, 3),...., [59, 60), 60+ | +| nums | INT32 | FIELD | 分桶内sql的个数 | +| datanode\_id | INT32 | FIELD | 该桶属于哪个 DataNode | + +* 仅管理员可执行操作 +* 查询示例: + +```SQL +IoTDB> select * from information_schema.queries_costs_histogram limit 10 ++------+----+-----------+ +| bin|nums|datanode_id| ++------+----+-----------+ +| [0,1)| 0| 1| +| [1,2)| 0| 1| +| [2,3)| 0| 1| +| [3,4)| 0| 1| +| [4,5)| 0| 1| +| [5,6)| 0| 1| +| [6,7)| 0| 1| +| [7,8)| 0| 1| +| [8,9)| 0| 1| +|[9,10)| 0| 1| ++------+----+-----------+ +``` + + ## 3. 权限说明 * 不支持通过`GRANT/REVOKE`语句对 `information_schema` 数据库及其下任何表进行权限操作 diff --git a/src/zh/UserGuide/latest-Table/Reference/System-Config-Manual.md b/src/zh/UserGuide/latest-Table/Reference/System-Config-Manual.md index 86ee645c0..15473c00a 100644 --- a/src/zh/UserGuide/latest-Table/Reference/System-Config-Manual.md +++ b/src/zh/UserGuide/latest-Table/Reference/System-Config-Manual.md @@ -1515,6 +1515,15 @@ IoTDB 配置文件位于 IoTDB 安装目录:`conf`文件夹下。 | 默认值 | 10000 | | 改后生效方式 | 热加载 | +- query_cost_stat_window + +| 名字 | query_cost_stat_window | +| ------------ |--------------------| +| 描述 | 查询耗时统计的窗口,单位为分钟。 | +| 类型 | Int32 | +| 默认值 | 0 | +| 改后生效方式 | 热加载 | + - query_timeout_threshold | 名字 | query_timeout_threshold | 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 e0c594dc4..418b08f66 100644 --- a/src/zh/UserGuide/latest-Table/Reference/System-Tables_apache.md +++ b/src/zh/UserGuide/latest-Table/Reference/System-Tables_apache.md @@ -39,32 +39,34 @@ IoTDB> show databases +------------------+-------+-----------------------+---------------------+---------------------+ IoTDB> show tables from information_schema -+--------------+-------+ -| TableName|TTL(ms)| -+--------------+-------+ -| columns| INF| -| config_nodes| INF| -|configurations| INF| -| data_nodes| INF| -| databases| INF| -| functions| INF| -| keywords| INF| -| models| INF| -| nodes| INF| -| pipe_plugins| INF| -| pipes| INF| -| queries| INF| -| regions| INF| -| subscriptions| INF| -| tables| INF| -| topics| INF| -| views| INF| -+--------------+-------+ ++-----------------------+-------+ +| TableName|TTL(ms)| ++-----------------------+-------+ +| columns| INF| +| config_nodes| INF| +| configurations| INF| +| connections| INF| +| current_queries| INF| +| data_nodes| INF| +| databases| INF| +| functions| INF| +| keywords| INF| +| nodes| INF| +| pipe_plugins| INF| +| pipes| INF| +| queries| INF| +|queries_costs_histogram| INF| +| regions| INF| +| subscriptions| INF| +| tables| INF| +| topics| INF| +| views| INF| ++-----------------------+-------+ ``` ## 2. 系统表 -* 名称:`DATABASES`, `TABLES`, `REGIONS`, `QUERIES`, `COLUMNS`, `PIPES`, `PIPE_PLUGINS`, `SUBSCRIPTION`, `TOPICS`, `VIEWS`, `MODELS`, `FUNCTIONS`, `CONFIGURATIONS`, `KEYWORDS`, `NODES`, `CONFIG_NODES`, `DATA_NODES`(详细介绍见后面小节) +* 名称:`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`(详细介绍见后面小节) * 操作:只读,只支持`SELECT`, `COUNT/SHOW DEVICES`, `DESC`,不支持对于表结构 / 内容的任意修改,如果修改将会报错:`"The database 'information_schema' can only be queried"` * 列名:系统表的列名均默认为小写,且用`_`分隔 @@ -367,7 +369,7 @@ IoTDB> select * from information_schema.views ### 2.11 MODELS 表 -> 该系统表从 V 2.0.5 版本开始提供 +> 该系统表从 V 2.0.5 版本开始提供,从V 2.0.8 版本开始不再提供 * 包含数据库内所有的模型信息 * 表结构如下表所示: @@ -585,6 +587,98 @@ IoTDB> select * from information_schema.data_nodes +-------+---------------+-----------------+-----------+--------+--------+-------------------+---------------------+ ``` +### 2.18 CONNECTIONS 表 + +> 该系统表从 V 2.0.8 版本开始提供 + +* 包含集群中所有连接。 +* 表结构如下表所示: + +| **列名** | **数据类型** | **列类型** | **说明** | +| -------------------- | -------------------- | ------------------ | ---------------- | +| datanode\_id | STRING | TAG | DataNode的ID | +| user\_id | STRING | TAG | 用户ID | +| session\_id | STRING | TAG | Session ID | +| user\_name | STRING | ATTRIBUTE | 用户名 | +| last\_active\_time | TIMESTAMP | ATTRIBUTE | 最近活跃时间 | +| client\_ip | STRING | ATTRIBUTE | 客户端IP | + +* 查询示例: + +```SQL +IoTDB> select * from information_schema.connections; ++-----------+-------+----------+---------+-----------------------------+---------+ +|datanode_id|user_id|session_id|user_name| last_active_time|client_ip| ++-----------+-------+----------+---------+-----------------------------+---------+ +| 1| 0| 2| root|2026-01-21T16:28:54.704+08:00|127.0.0.1| ++-----------+-------+----------+---------+-----------------------------+---------+ +``` + +### 2.19 CURRENT\_QUERIES 表 + +> 该系统表从 V 2.0.8 版本开始提供 + +* 包含所有执行结束时间在 `[now() - query_cost_stat_window, now())` 范围内的所有查询,也包括当前正在执行的查询。其中`query_cost_stat_window `代表查询耗时统计的窗口,默认值为 0 ,可通过配置文件`iotdb-system.properties`进行配置。 +* 表结构如下表所示: + +| 列名 | 数据类型 | 列类型 | 说明 | +| -------------- | ----------- | -------- | ------------------------------------------------------------------------------- | +| query\_id | STRING | TAG | 查询语句的 ID | +| state | STRING | FIELD | 查询状态,RUNNING 表示正在执行,FINISHED 表示已结束 | +| start\_time | TIMESTAMP | FIELD | 查询开始的时间戳,时间戳精度与系统精度保持一致 | +| end\_time | TIMESTAMP | FIELD | 查询结束的时间戳,时间戳精度与系统精度保持一致。若查询尚未结束,该列值为 NULL | +| datanode\_id | INT32 | FIELD | 该查询语句是从哪个 DataNode 发起的 | +| cost\_time| FLOAT | FIELD | 查询的执行耗时,单位是秒。若查询尚未结束,该列值为查询已执行时间 | +| statement | STRING | FIELD | 查询的sql / 查询请求拼接后的 sql | +| user | STRING | FIELD | 发起查询的用户 | +| client\_ip | STRING | FIELD | 发起查询的客户端 ip | + +* 普通用户查询结果仅显示自身执行的查询;管理员显示全部。 +* 查询示例: + +```SQL +IoTDB> select * from information_schema.current_queries; ++-----------------------+-------+-----------------------------+--------+-----------+---------+------------------------------------------------+----+---------+ +| query_id| state| start_time|end_time|datanode_id|cost_time| statement|user|client_ip| ++-----------------------+-------+-----------------------------+--------+-----------+---------+------------------------------------------------+----+---------+ +|20260121_085427_00013_1|RUNNING|2026-01-21T16:54:27.019+08:00| null| 1| 0.0|select * from information_schema.current_queries|root|127.0.0.1| ++-----------------------+-------+-----------------------------+--------+-----------+---------+------------------------------------------------+----+---------+ +``` + +### 2.20 QUERIES\_COSTS\_HISTOGRAM 表 + +> 该系统表从 V 2.0.8 版本开始提供 + +* 包含过去 `query_cost_stat_window` 时间内的查询耗时的直方图(仅统计已经执行结束的 SQL),其中`query_cost_stat_window `代表查询耗时统计的窗口,默认值为 0 ,可通过配置文件`iotdb-system.properties`进行配置。 +* 表结构如下表所示: + +| 列名 | 数据类型 | 列类型 | 说明 | +| -------------- | ---------- | -------- | -------------------------------------------------------------------- | +| bin| STRING | TAG| 分桶名:共包含61个分桶,[0, 1), [1, 2), [2, 3),...., [59, 60), 60+ | +| nums | INT32 | FIELD | 分桶内sql的个数 | +| datanode\_id | INT32 | FIELD | 该桶属于哪个 DataNode | + +* 仅管理员可执行操作 +* 查询示例: + +```SQL +IoTDB> select * from information_schema.queries_costs_histogram limit 10 ++------+----+-----------+ +| bin|nums|datanode_id| ++------+----+-----------+ +| [0,1)| 0| 1| +| [1,2)| 0| 1| +| [2,3)| 0| 1| +| [3,4)| 0| 1| +| [4,5)| 0| 1| +| [5,6)| 0| 1| +| [6,7)| 0| 1| +| [7,8)| 0| 1| +| [8,9)| 0| 1| +|[9,10)| 0| 1| ++------+----+-----------+ +``` + ## 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 f0f2fec5b..e13fa2c59 100644 --- a/src/zh/UserGuide/latest-Table/Reference/System-Tables_timecho.md +++ b/src/zh/UserGuide/latest-Table/Reference/System-Tables_timecho.md @@ -39,32 +39,34 @@ IoTDB> show databases +------------------+-------+-----------------------+---------------------+---------------------+ IoTDB> show tables from information_schema -+--------------+-------+ -| TableName|TTL(ms)| -+--------------+-------+ -| columns| INF| -| config_nodes| INF| -|configurations| INF| -| data_nodes| INF| -| databases| INF| -| functions| INF| -| keywords| INF| -| models| INF| -| nodes| INF| -| pipe_plugins| INF| -| pipes| INF| -| queries| INF| -| regions| INF| -| subscriptions| INF| -| tables| INF| -| topics| INF| -| views| INF| -+--------------+-------+ ++-----------------------+-------+ +| TableName|TTL(ms)| ++-----------------------+-------+ +| columns| INF| +| config_nodes| INF| +| configurations| INF| +| connections| INF| +| current_queries| INF| +| data_nodes| INF| +| databases| INF| +| functions| INF| +| keywords| INF| +| nodes| INF| +| pipe_plugins| INF| +| pipes| INF| +| queries| INF| +|queries_costs_histogram| INF| +| regions| INF| +| subscriptions| INF| +| tables| INF| +| topics| INF| +| views| INF| ++-----------------------+-------+ ``` ## 2. 系统表 -* 名称:`DATABASES`, `TABLES`, `REGIONS`, `QUERIES`, `COLUMNS`, `PIPES`, `PIPE_PLUGINS`, `SUBSCRIPTION`, `TOPICS`, `VIEWS`, `MODELS`, `FUNCTIONS`, `CONFIGURATIONS`, `KEYWORDS`, `NODES`, `CONFIG_NODES`, `DATA_NODES`(详细介绍见后面小节) +* 名称:`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`(详细介绍见后面小节) * 操作:只读,只支持`SELECT`, `COUNT/SHOW DEVICES`, `DESC`,不支持对于表结构 / 内容的任意修改,如果修改将会报错:`"The database 'information_schema' can only be queried"` * 列名:系统表的列名均默认为小写,且用`_`分隔 @@ -367,7 +369,7 @@ IoTDB> select * from information_schema.views ### 2.11 MODELS 表 -> 该系统表从 V 2.0.5 版本开始提供 +> 该系统表从 V 2.0.5 版本开始提供,从V 2.0.8 版本开始不再提供 * 包含数据库内所有的模型信息 * 表结构如下表所示: @@ -585,6 +587,99 @@ IoTDB> select * from information_schema.data_nodes +-------+---------------+-----------------+-----------+--------+--------+-------------------+---------------------+ ``` +### 2.18 CONNECTIONS 表 + +> 该系统表从 V 2.0.8 版本开始提供 + +* 包含集群中所有连接。 +* 表结构如下表所示: + +| **列名** | **数据类型** | **列类型** | **说明** | +| -------------------- | -------------------- | ------------------ | ---------------- | +| datanode\_id | STRING | TAG | DataNode的ID | +| user\_id | STRING | TAG | 用户ID | +| session\_id | STRING | TAG | Session ID | +| user\_name | STRING | ATTRIBUTE | 用户名 | +| last\_active\_time | TIMESTAMP | ATTRIBUTE | 最近活跃时间 | +| client\_ip | STRING | ATTRIBUTE | 客户端IP | + +* 查询示例: + +```SQL +IoTDB> select * from information_schema.connections; ++-----------+-------+----------+---------+-----------------------------+---------+ +|datanode_id|user_id|session_id|user_name| last_active_time|client_ip| ++-----------+-------+----------+---------+-----------------------------+---------+ +| 1| 0| 2| root|2026-01-21T16:28:54.704+08:00|127.0.0.1| ++-----------+-------+----------+---------+-----------------------------+---------+ +``` + +### 2.19 CURRENT\_QUERIES 表 + +> 该系统表从 V 2.0.8 版本开始提供 + +* 包含所有执行结束时间在 `[now() - query_cost_stat_window, now())` 范围内的所有查询,也包括当前正在执行的查询。其中`query_cost_stat_window `代表查询耗时统计的窗口,默认值为 0 ,可通过配置文件`iotdb-system.properties`进行配置。 +* 表结构如下表所示: + +| 列名 | 数据类型 | 列类型 | 说明 | +| -------------- | ----------- | -------- | ------------------------------------------------------------------------------- | +| query\_id | STRING | TAG | 查询语句的 ID | +| state | STRING | FIELD | 查询状态,RUNNING 表示正在执行,FINISHED 表示已结束 | +| start\_time | TIMESTAMP | FIELD | 查询开始的时间戳,时间戳精度与系统精度保持一致 | +| end\_time | TIMESTAMP | FIELD | 查询结束的时间戳,时间戳精度与系统精度保持一致。若查询尚未结束,该列值为 NULL | +| datanode\_id | INT32 | FIELD | 该查询语句是从哪个 DataNode 发起的 | +| cost\_time| FLOAT | FIELD | 查询的执行耗时,单位是秒。若查询尚未结束,该列值为查询已执行时间 | +| statement | STRING | FIELD | 查询的sql / 查询请求拼接后的 sql | +| user | STRING | FIELD | 发起查询的用户 | +| client\_ip | STRING | FIELD | 发起查询的客户端 ip | + +* 普通用户查询结果仅显示自身执行的查询;管理员显示全部。 +* 查询示例: + +```SQL +IoTDB> select * from information_schema.current_queries; ++-----------------------+-------+-----------------------------+--------+-----------+---------+------------------------------------------------+----+---------+ +| query_id| state| start_time|end_time|datanode_id|cost_time| statement|user|client_ip| ++-----------------------+-------+-----------------------------+--------+-----------+---------+------------------------------------------------+----+---------+ +|20260121_085427_00013_1|RUNNING|2026-01-21T16:54:27.019+08:00| null| 1| 0.0|select * from information_schema.current_queries|root|127.0.0.1| ++-----------------------+-------+-----------------------------+--------+-----------+---------+------------------------------------------------+----+---------+ +``` + +### 2.20 QUERIES\_COSTS\_HISTOGRAM 表 + +> 该系统表从 V 2.0.8 版本开始提供 + +* 包含过去 `query_cost_stat_window` 时间内的查询耗时的直方图(仅统计已经执行结束的 SQL),其中`query_cost_stat_window `代表查询耗时统计的窗口,默认值为 0 ,可通过配置文件`iotdb-system.properties`进行配置。 +* 表结构如下表所示: + +| 列名 | 数据类型 | 列类型 | 说明 | +| -------------- | ---------- | -------- | -------------------------------------------------------------------- | +| bin| STRING | TAG| 分桶名:共包含61个分桶,[0, 1), [1, 2), [2, 3),...., [59, 60), 60+ | +| nums | INT32 | FIELD | 分桶内sql的个数 | +| datanode\_id | INT32 | FIELD | 该桶属于哪个 DataNode | + +* 仅管理员可执行操作 +* 查询示例: + +```SQL +IoTDB> select * from information_schema.queries_costs_histogram limit 10 ++------+----+-----------+ +| bin|nums|datanode_id| ++------+----+-----------+ +| [0,1)| 0| 1| +| [1,2)| 0| 1| +| [2,3)| 0| 1| +| [3,4)| 0| 1| +| [4,5)| 0| 1| +| [5,6)| 0| 1| +| [6,7)| 0| 1| +| [7,8)| 0| 1| +| [8,9)| 0| 1| +|[9,10)| 0| 1| ++------+----+-----------+ +``` + + ## 3. 权限说明 * 不支持通过`GRANT/REVOKE`语句对 `information_schema` 数据库及其下任何表进行权限操作