Skip to content

Commit c1da9f4

Browse files
authored
add connections,current_queries,queries_costs_histogram to system tables 208 (#977)
1 parent 4ac05d8 commit c1da9f4

File tree

12 files changed

+978
-184
lines changed

12 files changed

+978
-184
lines changed

src/UserGuide/Master/Table/Reference/System-Config-Manual.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1538,6 +1538,15 @@ The `iotdb-system.properties` file contains various configurations for managing
15381538
| Default | 10000 |
15391539
| Effective | Hot reload |
15401540

1541+
- query_cost_stat_window
1542+
1543+
| Name | query_cost_stat_window |
1544+
|-------------|--------------------|
1545+
| Description | Time window threshold(min) for record of history queries. |
1546+
| Type | Int32 |
1547+
| Default | 0 |
1548+
| Effective | Hot reload |
1549+
15411550
- query_timeout_threshold
15421551

15431552
| Name | query_timeout_threshold |

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

Lines changed: 118 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -39,32 +39,34 @@ IoTDB> show databases
3939
+------------------+-------+-----------------------+---------------------+---------------------+
4040

4141
IoTDB> show tables from information_schema
42-
+--------------+-------+
43-
| TableName|TTL(ms)|
44-
+--------------+-------+
45-
| columns| INF|
46-
| config_nodes| INF|
47-
|configurations| INF|
48-
| data_nodes| INF|
49-
| databases| INF|
50-
| functions| INF|
51-
| keywords| INF|
52-
| models| INF|
53-
| nodes| INF|
54-
| pipe_plugins| INF|
55-
| pipes| INF|
56-
| queries| INF|
57-
| regions| INF|
58-
| subscriptions| INF|
59-
| tables| INF|
60-
| topics| INF|
61-
| views| INF|
62-
+--------------+-------+
42+
+-----------------------+-------+
43+
| TableName|TTL(ms)|
44+
+-----------------------+-------+
45+
| columns| INF|
46+
| config_nodes| INF|
47+
| configurations| INF|
48+
| connections| INF|
49+
| current_queries| INF|
50+
| data_nodes| INF|
51+
| databases| INF|
52+
| functions| INF|
53+
| keywords| INF|
54+
| nodes| INF|
55+
| pipe_plugins| INF|
56+
| pipes| INF|
57+
| queries| INF|
58+
|queries_costs_histogram| INF|
59+
| regions| INF|
60+
| subscriptions| INF|
61+
| tables| INF|
62+
| topics| INF|
63+
| views| INF|
64+
+-----------------------+-------+
6365
```
6466

6567
## 2. System Tables
6668

67-
***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)
69+
***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)
6870
***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." `
6971
***Column Names**​: System table column names are all lowercase by default and separated by underscores (`_`).
7072

@@ -369,7 +371,7 @@ IoTDB> select * from information_schema.views
369371

370372
### 2.11 MODELS Table
371373

372-
> This system table is available starting from version V2.0.5.
374+
> This system table is available starting from version V 2.0.5 and has been discontinued since version V 2.0.8.
373375
374376
* Contains information about all models in the database.
375377
* The table structure is as follows:
@@ -592,6 +594,99 @@ IoTDB> select * from information_schema.data_nodes
592594
+-------+---------------+-----------------+-----------+--------+--------+-------------------+---------------------+
593595
```
594596

597+
### 2.18 CONNECTIONS Table
598+
599+
> This system table is available starting from version V 2.0.8
600+
601+
* Contains all connections in the cluster.
602+
* The table structure is as follows:
603+
604+
| **Column Name** | **Data Type** | **Column Type** | **Description** |
605+
|-----------------|---------------|-----------------|------------------------|
606+
| datanode_id | STRING | TAG | DataNode ID |
607+
| user_id | STRING | TAG | User ID |
608+
| session_id | STRING | TAG | Session ID |
609+
| user_name | STRING | ATTRIBUTE | Username |
610+
| last_active_time| TIMESTAMP | ATTRIBUTE | Last active time |
611+
| client_ip | STRING | ATTRIBUTE | Client IP address |
612+
613+
* Query example:
614+
615+
```SQL
616+
IoTDB> select * from information_schema.connections;
617+
+-----------+-------+----------+---------+-----------------------------+---------+
618+
|datanode_id|user_id|session_id|user_name| last_active_time|client_ip|
619+
+-----------+-------+----------+---------+-----------------------------+---------+
620+
| 1| 0| 2| root|2026-01-21T16:28:54.704+08:00|127.0.0.1|
621+
+-----------+-------+----------+---------+-----------------------------+---------+
622+
```
623+
624+
### 2.19 CURRENT_QUERIES Table
625+
626+
> This system table is available starting from version V 2.0.8
627+
628+
* 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.
629+
* The table structure is as follows:
630+
631+
| Column Name | Data Type | Column Type | Description |
632+
|--------------|-----------|-------------|-----------------------------------------------------------------------------|
633+
| query_id | STRING | TAG | Query statement ID |
634+
| state | STRING | FIELD | Query state: RUNNING indicates executing, FINISHED indicates completed |
635+
| start_time | TIMESTAMP | FIELD | Query start timestamp (precision matches system timestamp precision) |
636+
| end_time | TIMESTAMP | FIELD | Query end timestamp (precision matches system timestamp precision). NULL if query is not yet finished |
637+
| datanode_id | INT32 | FIELD | DataNode from which the query was initiated |
638+
| cost_time | FLOAT | FIELD | Query execution time in seconds. If query is not finished, shows elapsed time |
639+
| statement | STRING | FIELD | Query SQL / concatenated query request SQL |
640+
| user | STRING | FIELD | User who initiated the query |
641+
| client_ip | STRING | FIELD | Client IP address that initiated the query |
642+
643+
* Regular users can only view their own queries; administrators can view all queries.
644+
* Query example:
645+
646+
```SQL
647+
IoTDB> select * from information_schema.current_queries;
648+
+-----------------------+-------+-----------------------------+--------+-----------+---------+------------------------------------------------+----+---------+
649+
| query_id| state| start_time|end_time|datanode_id|cost_time| statement|user|client_ip|
650+
+-----------------------+-------+-----------------------------+--------+-----------+---------+------------------------------------------------+----+---------+
651+
|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|
652+
+-----------------------+-------+-----------------------------+--------+-----------+---------+------------------------------------------------+----+---------+
653+
```
654+
655+
### 2.20 QUERIES_COSTS_HISTOGRAM Table
656+
657+
> This system table is available starting from version V 2.0.8
658+
659+
* 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.
660+
* The table structure is as follows:
661+
662+
| Column Name | Data Type | Column Type | Description |
663+
|--------------|-----------|-------------|-----------------------------------------------------------------------------|
664+
| bin | STRING | TAG | Bucket name: 61 buckets total - [0, 1), [1, 2), [2, 3), ..., [59, 60), 60+ |
665+
| nums | INT32 | FIELD | Number of SQL queries in the bucket |
666+
| datanode_id | INT32 | FIELD | DataNode to which this bucket belongs |
667+
668+
* Only administrators can execute operations on this table.
669+
* Query example:
670+
671+
```SQL
672+
IoTDB> select * from information_schema.queries_costs_histogram limit 10
673+
+------+----+-----------+
674+
| bin|nums|datanode_id|
675+
+------+----+-----------+
676+
| [0,1)| 0| 1|
677+
| [1,2)| 0| 1|
678+
| [2,3)| 0| 1|
679+
| [3,4)| 0| 1|
680+
| [4,5)| 0| 1|
681+
| [5,6)| 0| 1|
682+
| [6,7)| 0| 1|
683+
| [7,8)| 0| 1|
684+
| [8,9)| 0| 1|
685+
|[9,10)| 0| 1|
686+
+------+----+-----------+
687+
```
688+
689+
595690
## 3. Permission Description
596691

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

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

Lines changed: 118 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -39,32 +39,34 @@ IoTDB> show databases
3939
+------------------+-------+-----------------------+---------------------+---------------------+
4040

4141
IoTDB> show tables from information_schema
42-
+--------------+-------+
43-
| TableName|TTL(ms)|
44-
+--------------+-------+
45-
| columns| INF|
46-
| config_nodes| INF|
47-
|configurations| INF|
48-
| data_nodes| INF|
49-
| databases| INF|
50-
| functions| INF|
51-
| keywords| INF|
52-
| models| INF|
53-
| nodes| INF|
54-
| pipe_plugins| INF|
55-
| pipes| INF|
56-
| queries| INF|
57-
| regions| INF|
58-
| subscriptions| INF|
59-
| tables| INF|
60-
| topics| INF|
61-
| views| INF|
62-
+--------------+-------+
42+
+-----------------------+-------+
43+
| TableName|TTL(ms)|
44+
+-----------------------+-------+
45+
| columns| INF|
46+
| config_nodes| INF|
47+
| configurations| INF|
48+
| connections| INF|
49+
| current_queries| INF|
50+
| data_nodes| INF|
51+
| databases| INF|
52+
| functions| INF|
53+
| keywords| INF|
54+
| nodes| INF|
55+
| pipe_plugins| INF|
56+
| pipes| INF|
57+
| queries| INF|
58+
|queries_costs_histogram| INF|
59+
| regions| INF|
60+
| subscriptions| INF|
61+
| tables| INF|
62+
| topics| INF|
63+
| views| INF|
64+
+-----------------------+-------+
6365
```
6466

6567
## 2. System Tables
6668

67-
***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)
69+
***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)
6870
***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." `
6971
***Column Names**​: System table column names are all lowercase by default and separated by underscores (`_`).
7072

@@ -369,7 +371,7 @@ IoTDB> select * from information_schema.views
369371

370372
### 2.11 MODELS Table
371373

372-
> This system table is available starting from version V2.0.5.
374+
> This system table is available starting from version V 2.0.5 and has been discontinued since version V 2.0.8.
373375
374376
* Contains information about all models in the database.
375377
* The table structure is as follows:
@@ -592,6 +594,99 @@ IoTDB> select * from information_schema.data_nodes
592594
+-------+---------------+-----------------+-----------+--------+--------+-------------------+---------------------+
593595
```
594596

597+
### 2.18 CONNECTIONS Table
598+
599+
> This system table is available starting from version V 2.0.8
600+
601+
* Contains all connections in the cluster.
602+
* The table structure is as follows:
603+
604+
| **Column Name** | **Data Type** | **Column Type** | **Description** |
605+
|-----------------|---------------|-----------------|------------------------|
606+
| datanode_id | STRING | TAG | DataNode ID |
607+
| user_id | STRING | TAG | User ID |
608+
| session_id | STRING | TAG | Session ID |
609+
| user_name | STRING | ATTRIBUTE | Username |
610+
| last_active_time| TIMESTAMP | ATTRIBUTE | Last active time |
611+
| client_ip | STRING | ATTRIBUTE | Client IP address |
612+
613+
* Query example:
614+
615+
```SQL
616+
IoTDB> select * from information_schema.connections;
617+
+-----------+-------+----------+---------+-----------------------------+---------+
618+
|datanode_id|user_id|session_id|user_name| last_active_time|client_ip|
619+
+-----------+-------+----------+---------+-----------------------------+---------+
620+
| 1| 0| 2| root|2026-01-21T16:28:54.704+08:00|127.0.0.1|
621+
+-----------+-------+----------+---------+-----------------------------+---------+
622+
```
623+
624+
### 2.19 CURRENT_QUERIES Table
625+
626+
> This system table is available starting from version V 2.0.8
627+
628+
* 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.
629+
* The table structure is as follows:
630+
631+
| Column Name | Data Type | Column Type | Description |
632+
|--------------|-----------|-------------|-----------------------------------------------------------------------------|
633+
| query_id | STRING | TAG | Query statement ID |
634+
| state | STRING | FIELD | Query state: RUNNING indicates executing, FINISHED indicates completed |
635+
| start_time | TIMESTAMP | FIELD | Query start timestamp (precision matches system timestamp precision) |
636+
| end_time | TIMESTAMP | FIELD | Query end timestamp (precision matches system timestamp precision). NULL if query is not yet finished |
637+
| datanode_id | INT32 | FIELD | DataNode from which the query was initiated |
638+
| cost_time | FLOAT | FIELD | Query execution time in seconds. If query is not finished, shows elapsed time |
639+
| statement | STRING | FIELD | Query SQL / concatenated query request SQL |
640+
| user | STRING | FIELD | User who initiated the query |
641+
| client_ip | STRING | FIELD | Client IP address that initiated the query |
642+
643+
* Regular users can only view their own queries; administrators can view all queries.
644+
* Query example:
645+
646+
```SQL
647+
IoTDB> select * from information_schema.current_queries;
648+
+-----------------------+-------+-----------------------------+--------+-----------+---------+------------------------------------------------+----+---------+
649+
| query_id| state| start_time|end_time|datanode_id|cost_time| statement|user|client_ip|
650+
+-----------------------+-------+-----------------------------+--------+-----------+---------+------------------------------------------------+----+---------+
651+
|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|
652+
+-----------------------+-------+-----------------------------+--------+-----------+---------+------------------------------------------------+----+---------+
653+
```
654+
655+
### 2.20 QUERIES_COSTS_HISTOGRAM Table
656+
657+
> This system table is available starting from version V 2.0.8
658+
659+
* 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.
660+
* The table structure is as follows:
661+
662+
| Column Name | Data Type | Column Type | Description |
663+
|--------------|-----------|-------------|-----------------------------------------------------------------------------|
664+
| bin | STRING | TAG | Bucket name: 61 buckets total - [0, 1), [1, 2), [2, 3), ..., [59, 60), 60+ |
665+
| nums | INT32 | FIELD | Number of SQL queries in the bucket |
666+
| datanode_id | INT32 | FIELD | DataNode to which this bucket belongs |
667+
668+
* Only administrators can execute operations on this table.
669+
* Query example:
670+
671+
```SQL
672+
IoTDB> select * from information_schema.queries_costs_histogram limit 10
673+
+------+----+-----------+
674+
| bin|nums|datanode_id|
675+
+------+----+-----------+
676+
| [0,1)| 0| 1|
677+
| [1,2)| 0| 1|
678+
| [2,3)| 0| 1|
679+
| [3,4)| 0| 1|
680+
| [4,5)| 0| 1|
681+
| [5,6)| 0| 1|
682+
| [6,7)| 0| 1|
683+
| [7,8)| 0| 1|
684+
| [8,9)| 0| 1|
685+
|[9,10)| 0| 1|
686+
+------+----+-----------+
687+
```
688+
689+
595690
## 3. Permission Description
596691

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

src/UserGuide/latest-Table/Reference/System-Config-Manual.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1538,6 +1538,15 @@ The `iotdb-system.properties` file contains various configurations for managing
15381538
| Default | 10000 |
15391539
| Effective | Hot reload |
15401540

1541+
- query_cost_stat_window
1542+
1543+
| Name | query_cost_stat_window |
1544+
|-------------|--------------------|
1545+
| Description | Time window threshold(min) for record of history queries. |
1546+
| Type | Int32 |
1547+
| Default | 0 |
1548+
| Effective | Hot reload |
1549+
15411550
- query_timeout_threshold
15421551

15431552
| Name | query_timeout_threshold |

0 commit comments

Comments
 (0)