This is an automated email from the ASF dual-hosted git repository.

caogaofei pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iotdb-docs.git


The following commit(s) were added to refs/heads/main by this push:
     new 837417b  Docs for active metadata query
837417b is described below

commit 837417b8a3c81c4082b532d19483231f634c0b37
Author: YangCaiyin <[email protected]>
AuthorDate: Wed Jul 17 15:27:35 2024 +0800

    Docs for active metadata query
---
 src/.vuepress/sidebar_timecho/V1.3.x/en.ts         |  2 +-
 src/.vuepress/sidebar_timecho/V1.3.x/zh.ts         |  2 +-
 src/UserGuide/latest/SQL-Manual/SQL-Manual.md      |  2 +
 .../latest/User-Manual/Operate-Metadata.md         | 68 ++++++++++++++++++++
 ...ate-Metadata.md => Operate-Metadata_timecho.md} | 70 +++++++++++++++++++++
 src/zh/UserGuide/latest/SQL-Manual/SQL-Manual.md   | 17 +++--
 .../latest/User-Manual/Operate-Metadata.md         | 70 +++++++++++++++++++++
 ...ate-Metadata.md => Operate-Metadata_timecho.md} | 72 ++++++++++++++++++++++
 8 files changed, 295 insertions(+), 8 deletions(-)

diff --git a/src/.vuepress/sidebar_timecho/V1.3.x/en.ts 
b/src/.vuepress/sidebar_timecho/V1.3.x/en.ts
index 3efa6b5..3456ba3 100644
--- a/src/.vuepress/sidebar_timecho/V1.3.x/en.ts
+++ b/src/.vuepress/sidebar_timecho/V1.3.x/en.ts
@@ -86,7 +86,7 @@ export const enSidebar = {
       // children: 'structure',
       children: [
         { text: 'Syntax Rule', link: 'Syntax-Rule' },
-        { text: 'Operate Metadata', link: 'Operate-Metadata' },
+        { text: 'Operate Metadata', link: 'Operate-Metadata_timecho' },
         { text: 'Write Delete Data', link: 'Write-Delete-Data' },
         { text: 'Query Data', link: 'Query-Data' },
         { text: 'Operator and Expression', link: 'Operator-and-Expression' },
diff --git a/src/.vuepress/sidebar_timecho/V1.3.x/zh.ts 
b/src/.vuepress/sidebar_timecho/V1.3.x/zh.ts
index a1364d8..01b2a0b 100644
--- a/src/.vuepress/sidebar_timecho/V1.3.x/zh.ts
+++ b/src/.vuepress/sidebar_timecho/V1.3.x/zh.ts
@@ -86,7 +86,7 @@ export const zhSidebar = {
       // children: 'structure',
       children: [
         { text: '语法约定', link: 'Syntax-Rule' },
-        { text: '元数据管理', link: 'Operate-Metadata' },
+        { text: '元数据管理', link: 'Operate-Metadata_timecho' },
         { text: '数据增删', link: 'Write-Delete-Data' },
         { text: '数据查询', link: 'Query-Data' },
         { text: '运算符和表达式', link: 'Operator-and-Expression' },
diff --git a/src/UserGuide/latest/SQL-Manual/SQL-Manual.md 
b/src/UserGuide/latest/SQL-Manual/SQL-Manual.md
index ee94ba5..ca0ffff 100644
--- a/src/UserGuide/latest/SQL-Manual/SQL-Manual.md
+++ b/src/UserGuide/latest/SQL-Manual/SQL-Manual.md
@@ -234,6 +234,7 @@ IoTDB> show timeseries root.ln.**
 IoTDB> show timeseries root.ln.** limit 10 offset 10
 IoTDB> show timeseries root.ln.** where timeseries contains 'wf01.wt'
 IoTDB> show timeseries root.ln.** where dataType=FLOAT
+IoTDB> show timeseries root.ln.** where time>=2017-01-01T00:00:00 and 
time<=2017-11-01T16:26:00;
 ```
 
 ### Count Timeseries
@@ -248,6 +249,7 @@ IoTDB > COUNT TIMESERIES root.** WHERE DATATYPE = INT64
 IoTDB > COUNT TIMESERIES root.** WHERE TAGS(unit) contains 'c' 
 IoTDB > COUNT TIMESERIES root.** WHERE TAGS(unit) = 'c' 
 IoTDB > COUNT TIMESERIES root.** WHERE TIMESERIES contains 'sgcc' group by 
level = 1
+IoTDB > COUNT TIMESERIES root.** WHERE time>=2017-01-01T00:00:00 and 
time<=2017-11-01T16:26:00;
 IoTDB > COUNT TIMESERIES root.** GROUP BY LEVEL=1
 IoTDB > COUNT TIMESERIES root.ln.** GROUP BY LEVEL=2
 IoTDB > COUNT TIMESERIES root.ln.wf01.* GROUP BY LEVEL=2
diff --git a/src/UserGuide/latest/User-Manual/Operate-Metadata.md 
b/src/UserGuide/latest/User-Manual/Operate-Metadata.md
index fdfe893..ff29303 100644
--- a/src/UserGuide/latest/User-Manual/Operate-Metadata.md
+++ b/src/UserGuide/latest/User-Manual/Operate-Metadata.md
@@ -799,6 +799,44 @@ It costs 0.002s
 
 > Note: The path of timeseries is just a filter condition, which has no 
 > relationship with the definition of level.
 
+### Active Timeseries Query
+By adding WHERE time filter conditions to the existing SHOW/COUNT TIMESERIES, 
we can obtain time series with data within the specified time range.
+
+An example usage is as follows:
+```
+IoTDB> insert into root.sg.data(timestamp, s1,s2) values(15000, 1, 2);
+IoTDB> insert into root.sg.data2(timestamp, s1,s2) values(15002, 1, 2);
+IoTDB> insert into root.sg.data3(timestamp, s1,s2) values(16000, 1, 2);
+IoTDB> show timeseries;
++----------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+
+|      
Timeseries|Alias|Database|DataType|Encoding|Compression|Tags|Attributes|Deadband|DeadbandParameters|ViewType|
++----------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+
+| root.sg.data.s1| null| root.sg|   FLOAT| GORILLA|        LZ4|null|      
null|    null|              null|    BASE|
+| root.sg.data.s2| null| root.sg|   FLOAT| GORILLA|        LZ4|null|      
null|    null|              null|    BASE|
+|root.sg.data3.s1| null| root.sg|   FLOAT| GORILLA|        LZ4|null|      
null|    null|              null|    BASE|
+|root.sg.data3.s2| null| root.sg|   FLOAT| GORILLA|        LZ4|null|      
null|    null|              null|    BASE|
+|root.sg.data2.s1| null| root.sg|   FLOAT| GORILLA|        LZ4|null|      
null|    null|              null|    BASE|
+|root.sg.data2.s2| null| root.sg|   FLOAT| GORILLA|        LZ4|null|      
null|    null|              null|    BASE|
++----------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+
+
+IoTDB> show timeseries where time >= 15000 and time < 16000;
++----------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+
+|      
Timeseries|Alias|Database|DataType|Encoding|Compression|Tags|Attributes|Deadband|DeadbandParameters|ViewType|
++----------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+
+| root.sg.data.s1| null| root.sg|   FLOAT| GORILLA|        LZ4|null|      
null|    null|              null|    BASE|
+| root.sg.data.s2| null| root.sg|   FLOAT| GORILLA|        LZ4|null|      
null|    null|              null|    BASE|
+|root.sg.data2.s1| null| root.sg|   FLOAT| GORILLA|        LZ4|null|      
null|    null|              null|    BASE|
+|root.sg.data2.s2| null| root.sg|   FLOAT| GORILLA|        LZ4|null|      
null|    null|              null|    BASE|
++----------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+
+
+IoTDB> count timeseries where time >= 15000 and time < 16000;
++-----------------+
+|count(timeseries)|
++-----------------+
+|                4|
++-----------------+
+```
+Regarding the definition of active time series, data that can be queried 
normally is considered active, meaning time series that have been inserted but 
deleted are not included.
 ### Tag and Attribute Management
 
 We can also add an alias, extra tag and attribute information while creating 
one timeseries.
@@ -1214,3 +1252,33 @@ Total line number = 1
 It costs 0.004s
 ```
 
+### Active Device Query
+Similar to active timeseries query, we can add time filter conditions to 
device viewing and statistics to query active devices that have data within a 
certain time range. The definition of active here is the same as for active 
time series. An example usage is as follows:
+```
+IoTDB> insert into root.sg.data(timestamp, s1,s2) values(15000, 1, 2);
+IoTDB> insert into root.sg.data2(timestamp, s1,s2) values(15002, 1, 2);
+IoTDB> insert into root.sg.data3(timestamp, s1,s2) values(16000, 1, 2);
+IoTDB> show devices;
++-------------------+---------+
+|            devices|isAligned|
++-------------------+---------+
+|       root.sg.data|    false|
+|      root.sg.data2|    false|
+|      root.sg.data3|    false|
++-------------------+---------+
+
+IoTDB> show devices where time >= 15000 and time < 16000;
++-------------------+---------+
+|            devices|isAligned|
++-------------------+---------+
+|       root.sg.data|    false|
+|      root.sg.data2|    false|
++-------------------+---------+
+
+IoTDB> count devices where time >= 15000 and time < 16000;
++--------------+
+|count(devices)|
++--------------+
+|             2|
++--------------+
+```
\ No newline at end of file
diff --git a/src/UserGuide/latest/User-Manual/Operate-Metadata.md 
b/src/UserGuide/latest/User-Manual/Operate-Metadata_timecho.md
similarity index 91%
copy from src/UserGuide/latest/User-Manual/Operate-Metadata.md
copy to src/UserGuide/latest/User-Manual/Operate-Metadata_timecho.md
index fdfe893..0991b09 100644
--- a/src/UserGuide/latest/User-Manual/Operate-Metadata.md
+++ b/src/UserGuide/latest/User-Manual/Operate-Metadata_timecho.md
@@ -799,6 +799,46 @@ It costs 0.002s
 
 > Note: The path of timeseries is just a filter condition, which has no 
 > relationship with the definition of level.
 
+### Active Timeseries Query
+By adding WHERE time filter conditions to the existing SHOW/COUNT TIMESERIES, 
we can obtain time series with data within the specified time range.
+
+It is important to note that in metadata queries with time filters, views are 
not considered; only the time series actually stored in the TsFile are taken 
into account.
+
+An example usage is as follows:
+```
+IoTDB> insert into root.sg.data(timestamp, s1,s2) values(15000, 1, 2);
+IoTDB> insert into root.sg.data2(timestamp, s1,s2) values(15002, 1, 2);
+IoTDB> insert into root.sg.data3(timestamp, s1,s2) values(16000, 1, 2);
+IoTDB> show timeseries;
++----------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+
+|      
Timeseries|Alias|Database|DataType|Encoding|Compression|Tags|Attributes|Deadband|DeadbandParameters|ViewType|
++----------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+
+| root.sg.data.s1| null| root.sg|   FLOAT| GORILLA|        LZ4|null|      
null|    null|              null|    BASE|
+| root.sg.data.s2| null| root.sg|   FLOAT| GORILLA|        LZ4|null|      
null|    null|              null|    BASE|
+|root.sg.data3.s1| null| root.sg|   FLOAT| GORILLA|        LZ4|null|      
null|    null|              null|    BASE|
+|root.sg.data3.s2| null| root.sg|   FLOAT| GORILLA|        LZ4|null|      
null|    null|              null|    BASE|
+|root.sg.data2.s1| null| root.sg|   FLOAT| GORILLA|        LZ4|null|      
null|    null|              null|    BASE|
+|root.sg.data2.s2| null| root.sg|   FLOAT| GORILLA|        LZ4|null|      
null|    null|              null|    BASE|
++----------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+
+
+IoTDB> show timeseries where time >= 15000 and time < 16000;
++----------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+
+|      
Timeseries|Alias|Database|DataType|Encoding|Compression|Tags|Attributes|Deadband|DeadbandParameters|ViewType|
++----------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+
+| root.sg.data.s1| null| root.sg|   FLOAT| GORILLA|        LZ4|null|      
null|    null|              null|    BASE|
+| root.sg.data.s2| null| root.sg|   FLOAT| GORILLA|        LZ4|null|      
null|    null|              null|    BASE|
+|root.sg.data2.s1| null| root.sg|   FLOAT| GORILLA|        LZ4|null|      
null|    null|              null|    BASE|
+|root.sg.data2.s2| null| root.sg|   FLOAT| GORILLA|        LZ4|null|      
null|    null|              null|    BASE|
++----------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+
+
+IoTDB> count timeseries where time >= 15000 and time < 16000;
++-----------------+
+|count(timeseries)|
++-----------------+
+|                4|
++-----------------+
+```
+Regarding the definition of active time series, data that can be queried 
normally is considered active, meaning time series that have been inserted but 
deleted are not included.
 ### Tag and Attribute Management
 
 We can also add an alias, extra tag and attribute information while creating 
one timeseries.
@@ -1214,3 +1254,33 @@ Total line number = 1
 It costs 0.004s
 ```
 
+### Active Device Query
+Similar to active timeseries query, we can add time filter conditions to 
device viewing and statistics to query active devices that have data within a 
certain time range. The definition of active here is the same as for active 
time series. An example usage is as follows:
+```
+IoTDB> insert into root.sg.data(timestamp, s1,s2) values(15000, 1, 2);
+IoTDB> insert into root.sg.data2(timestamp, s1,s2) values(15002, 1, 2);
+IoTDB> insert into root.sg.data3(timestamp, s1,s2) values(16000, 1, 2);
+IoTDB> show devices;
++-------------------+---------+
+|            devices|isAligned|
++-------------------+---------+
+|       root.sg.data|    false|
+|      root.sg.data2|    false|
+|      root.sg.data3|    false|
++-------------------+---------+
+
+IoTDB> show devices where time >= 15000 and time < 16000;
++-------------------+---------+
+|            devices|isAligned|
++-------------------+---------+
+|       root.sg.data|    false|
+|      root.sg.data2|    false|
++-------------------+---------+
+
+IoTDB> count devices where time >= 15000 and time < 16000;
++--------------+
+|count(devices)|
++--------------+
+|             2|
++--------------+
+```
\ No newline at end of file
diff --git a/src/zh/UserGuide/latest/SQL-Manual/SQL-Manual.md 
b/src/zh/UserGuide/latest/SQL-Manual/SQL-Manual.md
index 9d81aba..c904b66 100644
--- a/src/zh/UserGuide/latest/SQL-Manual/SQL-Manual.md
+++ b/src/zh/UserGuide/latest/SQL-Manual/SQL-Manual.md
@@ -86,11 +86,12 @@ drop timeseries root.ln.wf02.*
 ```sql
 SHOW TIMESERIES
 SHOW TIMESERIES <Path>
-show timeseries root.**
-show timeseries root.ln.**
-show timeseries root.ln.** limit 10 offset 10
-show timeseries root.ln.** where timeseries contains 'wf01.wt'
-show timeseries root.ln.** where dataType=FLOAT
+SHOW TIMESERIES root.**
+SHOW TIMESERIES root.ln.**
+SHOW TIMESERIES root.ln.** limit 10 offset 10
+SHOW TIMESERIES root.ln.** where timeseries contains 'wf01.wt'
+SHOW TIMESERIES root.ln.** where dataType=FLOAT
+SHOW TIMESERIES root.ln.** where time>=2017-01-01T00:00:00 and 
time<=2017-11-01T16:26:00;
 SHOW LATEST TIMESERIES
 ```
 
@@ -106,6 +107,7 @@ COUNT TIMESERIES root.** WHERE DATATYPE = INT64
 COUNT TIMESERIES root.** WHERE TAGS(unit) contains 'c' 
 COUNT TIMESERIES root.** WHERE TAGS(unit) = 'c' 
 COUNT TIMESERIES root.** WHERE TIMESERIES contains 'sgcc' group by level = 1
+COUNT TIMESERIES root.** WHERE time>=2017-01-01T00:00:00 and 
time<=2017-11-01T16:26:00;
 COUNT TIMESERIES root.** GROUP BY LEVEL=1
 COUNT TIMESERIES root.ln.** GROUP BY LEVEL=2
 COUNT TIMESERIES root.ln.wf01.* GROUP BY LEVEL=2
@@ -218,6 +220,8 @@ SHOW CHILD NODES pathPattern
 IoTDB> show devices
 
 IoTDB> show devices root.ln.**
+
+IoTDB> show devices where time>=2017-01-01T00:00:00 and 
time<=2017-11-01T16:26:00;
 ```
 ##### 查看设备及其 database 信息
 
@@ -240,11 +244,12 @@ IoTDB > COUNT NODES root.**.temperature LEVEL=3
 #### 统计设备数量
 
 ```sql
-IoTDB> show devices
 
 IoTDB> count devices
 
 IoTDB> count devices root.ln.**
+
+IoTDB> count devices where time>=2017-01-01T00:00:00 and 
time<=2017-11-01T16:26:00;
 ```
 ### 4、设备模板管理
 
diff --git a/src/zh/UserGuide/latest/User-Manual/Operate-Metadata.md 
b/src/zh/UserGuide/latest/User-Manual/Operate-Metadata.md
index 8e8b262..722d5dd 100644
--- a/src/zh/UserGuide/latest/User-Manual/Operate-Metadata.md
+++ b/src/zh/UserGuide/latest/User-Manual/Operate-Metadata.md
@@ -779,6 +779,45 @@ It costs 0.002s
 
 > 注意:时间序列的路径只是过滤条件,与 level 的定义无关。
 
+### 活跃时间序列查询
+我们在原有的时间序列查询和统计上添加新的WHERE时间过滤条件,可以得到在指定时间范围中存在数据的时间序列。
+
+一个使用样例如下:
+```
+IoTDB> insert into root.sg.data(timestamp, s1,s2) values(15000, 1, 2);
+IoTDB> insert into root.sg.data2(timestamp, s1,s2) values(15002, 1, 2);
+IoTDB> insert into root.sg.data3(timestamp, s1,s2) values(16000, 1, 2);
+IoTDB> show timeseries;
++----------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+
+|      
Timeseries|Alias|Database|DataType|Encoding|Compression|Tags|Attributes|Deadband|DeadbandParameters|ViewType|
++----------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+
+| root.sg.data.s1| null| root.sg|   FLOAT| GORILLA|        LZ4|null|      
null|    null|              null|    BASE|
+| root.sg.data.s2| null| root.sg|   FLOAT| GORILLA|        LZ4|null|      
null|    null|              null|    BASE|
+|root.sg.data3.s1| null| root.sg|   FLOAT| GORILLA|        LZ4|null|      
null|    null|              null|    BASE|
+|root.sg.data3.s2| null| root.sg|   FLOAT| GORILLA|        LZ4|null|      
null|    null|              null|    BASE|
+|root.sg.data2.s1| null| root.sg|   FLOAT| GORILLA|        LZ4|null|      
null|    null|              null|    BASE|
+|root.sg.data2.s2| null| root.sg|   FLOAT| GORILLA|        LZ4|null|      
null|    null|              null|    BASE|
++----------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+
+
+IoTDB> show timeseries where time >= 15000 and time < 16000;
++----------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+
+|      
Timeseries|Alias|Database|DataType|Encoding|Compression|Tags|Attributes|Deadband|DeadbandParameters|ViewType|
++----------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+
+| root.sg.data.s1| null| root.sg|   FLOAT| GORILLA|        LZ4|null|      
null|    null|              null|    BASE|
+| root.sg.data.s2| null| root.sg|   FLOAT| GORILLA|        LZ4|null|      
null|    null|              null|    BASE|
+|root.sg.data2.s1| null| root.sg|   FLOAT| GORILLA|        LZ4|null|      
null|    null|              null|    BASE|
+|root.sg.data2.s2| null| root.sg|   FLOAT| GORILLA|        LZ4|null|      
null|    null|              null|    BASE|
++----------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+
+
+IoTDB> count timeseries where time >= 15000 and time < 16000;
++-----------------+
+|count(timeseries)|
++-----------------+
+|                4|
++-----------------+
+```
+关于活跃时间序列的定义,能通过正常查询查出来的数据就是活跃数据,也就是说插入但被删除的时间序列不在考虑范围内。
+
 ### 标签点管理
 
 我们可以在创建时间序列的时候,为它添加别名和额外的标签和属性信息。
@@ -1217,3 +1256,34 @@ It costs 0.004s
 Total line number = 1
 It costs 0.004s
 ```
+
+### 活跃设备查询
+和活跃时间序列一样,我们可以在查看和统计设备的基础上添加时间过滤条件来查询在某段时间内存在数据的活跃设备。这里活跃的定义与活跃时间序列相同,使用样例如下:
+```
+IoTDB> insert into root.sg.data(timestamp, s1,s2) values(15000, 1, 2);
+IoTDB> insert into root.sg.data2(timestamp, s1,s2) values(15002, 1, 2);
+IoTDB> insert into root.sg.data3(timestamp, s1,s2) values(16000, 1, 2);
+IoTDB> show devices;
++-------------------+---------+
+|            devices|isAligned|
++-------------------+---------+
+|       root.sg.data|    false|
+|      root.sg.data2|    false|
+|      root.sg.data3|    false|
++-------------------+---------+
+
+IoTDB> show devices where time >= 15000 and time < 16000;
++-------------------+---------+
+|            devices|isAligned|
++-------------------+---------+
+|       root.sg.data|    false|
+|      root.sg.data2|    false|
++-------------------+---------+
+
+IoTDB> count devices where time >= 15000 and time < 16000;
++--------------+
+|count(devices)|
++--------------+
+|             2|
++--------------+
+```
\ No newline at end of file
diff --git a/src/zh/UserGuide/latest/User-Manual/Operate-Metadata.md 
b/src/zh/UserGuide/latest/User-Manual/Operate-Metadata_timecho.md
similarity index 91%
copy from src/zh/UserGuide/latest/User-Manual/Operate-Metadata.md
copy to src/zh/UserGuide/latest/User-Manual/Operate-Metadata_timecho.md
index 8e8b262..677a5a9 100644
--- a/src/zh/UserGuide/latest/User-Manual/Operate-Metadata.md
+++ b/src/zh/UserGuide/latest/User-Manual/Operate-Metadata_timecho.md
@@ -779,6 +779,47 @@ It costs 0.002s
 
 > 注意:时间序列的路径只是过滤条件,与 level 的定义无关。
 
+### 活跃时间序列查询
+我们在原有的时间序列查询和统计上添加新的WHERE时间过滤条件,可以得到在指定时间范围中存在数据的时间序列。
+
+需要注意的是, 在带有时间过滤的元数据查询中并不考虑视图的存在,只考虑TsFile中实际存储的时间序列。
+
+一个使用样例如下:
+```
+IoTDB> insert into root.sg.data(timestamp, s1,s2) values(15000, 1, 2);
+IoTDB> insert into root.sg.data2(timestamp, s1,s2) values(15002, 1, 2);
+IoTDB> insert into root.sg.data3(timestamp, s1,s2) values(16000, 1, 2);
+IoTDB> show timeseries;
++----------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+
+|      
Timeseries|Alias|Database|DataType|Encoding|Compression|Tags|Attributes|Deadband|DeadbandParameters|ViewType|
++----------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+
+| root.sg.data.s1| null| root.sg|   FLOAT| GORILLA|        LZ4|null|      
null|    null|              null|    BASE|
+| root.sg.data.s2| null| root.sg|   FLOAT| GORILLA|        LZ4|null|      
null|    null|              null|    BASE|
+|root.sg.data3.s1| null| root.sg|   FLOAT| GORILLA|        LZ4|null|      
null|    null|              null|    BASE|
+|root.sg.data3.s2| null| root.sg|   FLOAT| GORILLA|        LZ4|null|      
null|    null|              null|    BASE|
+|root.sg.data2.s1| null| root.sg|   FLOAT| GORILLA|        LZ4|null|      
null|    null|              null|    BASE|
+|root.sg.data2.s2| null| root.sg|   FLOAT| GORILLA|        LZ4|null|      
null|    null|              null|    BASE|
++----------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+
+
+IoTDB> show timeseries where time >= 15000 and time < 16000;
++----------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+
+|      
Timeseries|Alias|Database|DataType|Encoding|Compression|Tags|Attributes|Deadband|DeadbandParameters|ViewType|
++----------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+
+| root.sg.data.s1| null| root.sg|   FLOAT| GORILLA|        LZ4|null|      
null|    null|              null|    BASE|
+| root.sg.data.s2| null| root.sg|   FLOAT| GORILLA|        LZ4|null|      
null|    null|              null|    BASE|
+|root.sg.data2.s1| null| root.sg|   FLOAT| GORILLA|        LZ4|null|      
null|    null|              null|    BASE|
+|root.sg.data2.s2| null| root.sg|   FLOAT| GORILLA|        LZ4|null|      
null|    null|              null|    BASE|
++----------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+
+
+IoTDB> count timeseries where time >= 15000 and time < 16000;
++-----------------+
+|count(timeseries)|
++-----------------+
+|                4|
++-----------------+
+```
+关于活跃时间序列的定义,能通过正常查询查出来的数据就是活跃数据,也就是说插入但被删除的时间序列不在考虑范围内。
+
 ### 标签点管理
 
 我们可以在创建时间序列的时候,为它添加别名和额外的标签和属性信息。
@@ -1217,3 +1258,34 @@ It costs 0.004s
 Total line number = 1
 It costs 0.004s
 ```
+
+### 活跃设备查询
+和活跃时间序列一样,我们可以在查看和统计设备的基础上添加时间过滤条件来查询在某段时间内存在数据的活跃设备。这里活跃的定义与活跃时间序列相同,使用样例如下:
+```
+IoTDB> insert into root.sg.data(timestamp, s1,s2) values(15000, 1, 2);
+IoTDB> insert into root.sg.data2(timestamp, s1,s2) values(15002, 1, 2);
+IoTDB> insert into root.sg.data3(timestamp, s1,s2) values(16000, 1, 2);
+IoTDB> show devices;
++-------------------+---------+
+|            devices|isAligned|
++-------------------+---------+
+|       root.sg.data|    false|
+|      root.sg.data2|    false|
+|      root.sg.data3|    false|
++-------------------+---------+
+
+IoTDB> show devices where time >= 15000 and time < 16000;
++-------------------+---------+
+|            devices|isAligned|
++-------------------+---------+
+|       root.sg.data|    false|
+|      root.sg.data2|    false|
++-------------------+---------+
+
+IoTDB> count devices where time >= 15000 and time < 16000;
++--------------+
+|count(devices)|
++--------------+
+|             2|
++--------------+
+```
\ No newline at end of file

Reply via email to