diff --git a/src/UserGuide/Master/Tree/Basic-Concept/Operate-Metadata_apache.md b/src/UserGuide/Master/Tree/Basic-Concept/Operate-Metadata_apache.md index 98d44745f..62de24c4e 100644 --- a/src/UserGuide/Master/Tree/Basic-Concept/Operate-Metadata_apache.md +++ b/src/UserGuide/Master/Tree/Basic-Concept/Operate-Metadata_apache.md @@ -666,21 +666,28 @@ drop timeseries root.ln.wf02.*; ### 3.4 Show Timeseries -* SHOW LATEST? TIMESERIES pathPattern? whereClause? limitClause? +#### 1. Grammar - There are four optional clauses added in SHOW TIMESERIES, return information of time series - -Timeseries information includes: timeseries path, alias of measurement, database it belongs to, data type, encoding type, compression type, tags and attributes. +```sql +// ---- Show Timeseries +showTimeseries + : SHOW LATEST? TIMESERIES prefixPath? timeseriesWhereClause? timeConditionClause? orderByTimeseriesClause? rowPaginationClause? + ; +// order by timeseries for SHOW TIMESERIES +orderByTimeseriesClause + : ORDER BY TIMESERIES (ASC | DESC)? + ; +``` -Examples: +The timeseries query results include: timeseries path, database, alias of measurement, data type, encoding, compression, tags and attributes, etc. -* SHOW TIMESERIES +> Note: Since V2.0.11, the query results can be sorted by timeseries name. - presents all timeseries information in JSON form +#### 2. Usage -* SHOW TIMESERIES <`PathPattern`> +* **`SHOW TIMESERIES`**: presents all timeseries information in the system - returns all timeseries information matching the given <`PathPattern`>. SQL statements are as follows: +* **`SHOW TIMESERIES `**: returns all timeseries information under the given path. The `Path` should be a timeseries path or a path pattern. For example, to view the timeseries under the `root` path and the `root.ln` path respectively, the SQL statements are as follows: ```sql show timeseries root.**; @@ -716,17 +723,13 @@ Total line number = 4 It costs 0.004s ``` -* SHOW TIMESERIES LIMIT INT OFFSET INT - - returns all the timeseries information start from the offset and limit the number of series returned. For example, +* **`SHOW TIMESERIES LIMIT INT OFFSET INT`**: returns all the timeseries information start from the offset and limit the number of series returned. For example, ```sql show timeseries root.ln.** limit 10 offset 10 ``` -* SHOW TIMESERIES WHERE TIMESERIES contains 'containStr' - - The query result set is filtered by string fuzzy matching based on the names of the timeseries. For example: +* **`SHOW TIMESERIES WHERE TIMESERIES contains 'containStr'`**: The query result set is filtered by string fuzzy matching based on the names of the timeseries. For example: ```sql show timeseries root.ln.** where timeseries contains 'wf01.wt' @@ -745,9 +748,7 @@ Total line number = 2 It costs 0.016s ``` -* SHOW TIMESERIES WHERE DataType=type - - The query result set is filtered by data type. For example: +* **`SHOW TIMESERIES WHERE DataType=type`**: The query result set is filtered by data type. For example: ```sql show timeseries root.ln.** where dataType=FLOAT @@ -768,10 +769,7 @@ It costs 0.016s ``` -* SHOW TIMESERIES WHERE TAGS(KEY) = VALUE -* SHOW TIMESERIES WHERE TAGS(KEY) CONTAINS VALUE - - The query result set is filtered by tags. For example: +* **`SHOW TIMESERIES WHERE TAGS(KEY) = VALUE`** / **`SHOW TIMESERIES WHERE TAGS(KEY) CONTAINS VALUE`**: The query result set is filtered by tags. For example: ```sql show timeseries root.ln.** where TAGS(unit)='c'; @@ -800,11 +798,57 @@ It costs 0.004s ``` -* SHOW LATEST TIMESERIES +* **`SHOW LATEST TIMESERIES`**: the returned timeseries are sorted in descending order of the last insertion timestamp. Note that when the queried path does not exist, the system will return 0 timeseries. + +* **`SHOW INVALID TIMESERIES`**: Since V2.0.8, this SQL statement is supported to show the invalidated timeseries after a full path rename succeeds. + +```sql +show invalid timeSeries +``` + +``` ++-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+----------------------------------+ +| Timeseries|Alias|Database|DataType|Encoding|Compression|Tags|Attributes|Deadband|DeadbandParameters|ViewType| NewPath| ++-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+----------------------------------+ +|root.ln.wf01.wt01.temperature| null| root.ln| FLOAT| GORILLA| LZ4|null| null| null| null| BASE|root.newln.newwf.newwt.temperature| ++-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+----------------------------------+ +``` + +Note: The last column `NewPath` in the result shows the new timeseries corresponding to the invalidated one, which serves scenarios such as view construction and cluster migration (Load + rename). + +* **`SHOW TIMESERIES ORDER BY TIMESERIES (ASC | DESC)`**: Since V2.0.11, the query results can be sorted by timeseries name. + +```sql +-- Sort by timeseries name in descending order +show timeseries root.ln.** order by timeseries desc +``` + +``` ++-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+ +| Timeseries|Alias|Database|DataType|Encoding|Compression|Tags|Attributes|Deadband|DeadbandParameters|ViewType| ++-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+ +| root.ln.wf02.wt02.status| null| root.ln| BOOLEAN| RLE| LZ4|null| null| null| null| BASE| +| root.ln.wf02.wt02.hardware| null| root.ln| TEXT| PLAIN| LZ4|null| null| null| null| BASE| +|root.ln.wf01.wt01.temperature| null| root.ln| FLOAT| GORILLA| LZ4|null| null| null| null| BASE| +| root.ln.wf01.wt01.status| null| root.ln| BOOLEAN| RLE| LZ4|null| null| null| null| BASE| ++-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+ +``` - all the returned timeseries information should be sorted in descending order of the last timestamp of timeseries +```sql +-- Sort by timeseries name in ascending order +show timeseries root.ln.** order by timeseries asc +``` -It is worth noting that when the queried path does not exist, the system will return no timeseries. +``` ++-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+ +| Timeseries|Alias|Database|DataType|Encoding|Compression|Tags|Attributes|Deadband|DeadbandParameters|ViewType| ++-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+ +| root.ln.wf01.wt01.status| null| root.ln| BOOLEAN| RLE| LZ4|null| null| null| null| BASE| +|root.ln.wf01.wt01.temperature| null| root.ln| FLOAT| GORILLA| LZ4|null| null| null| null| BASE| +| root.ln.wf02.wt02.hardware| null| root.ln| TEXT| PLAIN| LZ4|null| null| null| null| BASE| +| root.ln.wf02.wt02.status| null| root.ln| BOOLEAN| RLE| LZ4|null| null| null| null| BASE| ++-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+ +``` ### 3.5 Count Timeseries diff --git a/src/UserGuide/latest/Basic-Concept/Operate-Metadata_apache.md b/src/UserGuide/latest/Basic-Concept/Operate-Metadata_apache.md index 98d44745f..62de24c4e 100644 --- a/src/UserGuide/latest/Basic-Concept/Operate-Metadata_apache.md +++ b/src/UserGuide/latest/Basic-Concept/Operate-Metadata_apache.md @@ -666,21 +666,28 @@ drop timeseries root.ln.wf02.*; ### 3.4 Show Timeseries -* SHOW LATEST? TIMESERIES pathPattern? whereClause? limitClause? +#### 1. Grammar - There are four optional clauses added in SHOW TIMESERIES, return information of time series - -Timeseries information includes: timeseries path, alias of measurement, database it belongs to, data type, encoding type, compression type, tags and attributes. +```sql +// ---- Show Timeseries +showTimeseries + : SHOW LATEST? TIMESERIES prefixPath? timeseriesWhereClause? timeConditionClause? orderByTimeseriesClause? rowPaginationClause? + ; +// order by timeseries for SHOW TIMESERIES +orderByTimeseriesClause + : ORDER BY TIMESERIES (ASC | DESC)? + ; +``` -Examples: +The timeseries query results include: timeseries path, database, alias of measurement, data type, encoding, compression, tags and attributes, etc. -* SHOW TIMESERIES +> Note: Since V2.0.11, the query results can be sorted by timeseries name. - presents all timeseries information in JSON form +#### 2. Usage -* SHOW TIMESERIES <`PathPattern`> +* **`SHOW TIMESERIES`**: presents all timeseries information in the system - returns all timeseries information matching the given <`PathPattern`>. SQL statements are as follows: +* **`SHOW TIMESERIES `**: returns all timeseries information under the given path. The `Path` should be a timeseries path or a path pattern. For example, to view the timeseries under the `root` path and the `root.ln` path respectively, the SQL statements are as follows: ```sql show timeseries root.**; @@ -716,17 +723,13 @@ Total line number = 4 It costs 0.004s ``` -* SHOW TIMESERIES LIMIT INT OFFSET INT - - returns all the timeseries information start from the offset and limit the number of series returned. For example, +* **`SHOW TIMESERIES LIMIT INT OFFSET INT`**: returns all the timeseries information start from the offset and limit the number of series returned. For example, ```sql show timeseries root.ln.** limit 10 offset 10 ``` -* SHOW TIMESERIES WHERE TIMESERIES contains 'containStr' - - The query result set is filtered by string fuzzy matching based on the names of the timeseries. For example: +* **`SHOW TIMESERIES WHERE TIMESERIES contains 'containStr'`**: The query result set is filtered by string fuzzy matching based on the names of the timeseries. For example: ```sql show timeseries root.ln.** where timeseries contains 'wf01.wt' @@ -745,9 +748,7 @@ Total line number = 2 It costs 0.016s ``` -* SHOW TIMESERIES WHERE DataType=type - - The query result set is filtered by data type. For example: +* **`SHOW TIMESERIES WHERE DataType=type`**: The query result set is filtered by data type. For example: ```sql show timeseries root.ln.** where dataType=FLOAT @@ -768,10 +769,7 @@ It costs 0.016s ``` -* SHOW TIMESERIES WHERE TAGS(KEY) = VALUE -* SHOW TIMESERIES WHERE TAGS(KEY) CONTAINS VALUE - - The query result set is filtered by tags. For example: +* **`SHOW TIMESERIES WHERE TAGS(KEY) = VALUE`** / **`SHOW TIMESERIES WHERE TAGS(KEY) CONTAINS VALUE`**: The query result set is filtered by tags. For example: ```sql show timeseries root.ln.** where TAGS(unit)='c'; @@ -800,11 +798,57 @@ It costs 0.004s ``` -* SHOW LATEST TIMESERIES +* **`SHOW LATEST TIMESERIES`**: the returned timeseries are sorted in descending order of the last insertion timestamp. Note that when the queried path does not exist, the system will return 0 timeseries. + +* **`SHOW INVALID TIMESERIES`**: Since V2.0.8, this SQL statement is supported to show the invalidated timeseries after a full path rename succeeds. + +```sql +show invalid timeSeries +``` + +``` ++-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+----------------------------------+ +| Timeseries|Alias|Database|DataType|Encoding|Compression|Tags|Attributes|Deadband|DeadbandParameters|ViewType| NewPath| ++-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+----------------------------------+ +|root.ln.wf01.wt01.temperature| null| root.ln| FLOAT| GORILLA| LZ4|null| null| null| null| BASE|root.newln.newwf.newwt.temperature| ++-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+----------------------------------+ +``` + +Note: The last column `NewPath` in the result shows the new timeseries corresponding to the invalidated one, which serves scenarios such as view construction and cluster migration (Load + rename). + +* **`SHOW TIMESERIES ORDER BY TIMESERIES (ASC | DESC)`**: Since V2.0.11, the query results can be sorted by timeseries name. + +```sql +-- Sort by timeseries name in descending order +show timeseries root.ln.** order by timeseries desc +``` + +``` ++-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+ +| Timeseries|Alias|Database|DataType|Encoding|Compression|Tags|Attributes|Deadband|DeadbandParameters|ViewType| ++-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+ +| root.ln.wf02.wt02.status| null| root.ln| BOOLEAN| RLE| LZ4|null| null| null| null| BASE| +| root.ln.wf02.wt02.hardware| null| root.ln| TEXT| PLAIN| LZ4|null| null| null| null| BASE| +|root.ln.wf01.wt01.temperature| null| root.ln| FLOAT| GORILLA| LZ4|null| null| null| null| BASE| +| root.ln.wf01.wt01.status| null| root.ln| BOOLEAN| RLE| LZ4|null| null| null| null| BASE| ++-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+ +``` - all the returned timeseries information should be sorted in descending order of the last timestamp of timeseries +```sql +-- Sort by timeseries name in ascending order +show timeseries root.ln.** order by timeseries asc +``` -It is worth noting that when the queried path does not exist, the system will return no timeseries. +``` ++-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+ +| Timeseries|Alias|Database|DataType|Encoding|Compression|Tags|Attributes|Deadband|DeadbandParameters|ViewType| ++-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+ +| root.ln.wf01.wt01.status| null| root.ln| BOOLEAN| RLE| LZ4|null| null| null| null| BASE| +|root.ln.wf01.wt01.temperature| null| root.ln| FLOAT| GORILLA| LZ4|null| null| null| null| BASE| +| root.ln.wf02.wt02.hardware| null| root.ln| TEXT| PLAIN| LZ4|null| null| null| null| BASE| +| root.ln.wf02.wt02.status| null| root.ln| BOOLEAN| RLE| LZ4|null| null| null| null| BASE| ++-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+ +``` ### 3.5 Count Timeseries diff --git a/src/zh/UserGuide/Master/Tree/Basic-Concept/Operate-Metadata_apache.md b/src/zh/UserGuide/Master/Tree/Basic-Concept/Operate-Metadata_apache.md index 0b1aeadb6..2c2d452aa 100644 --- a/src/zh/UserGuide/Master/Tree/Basic-Concept/Operate-Metadata_apache.md +++ b/src/zh/UserGuide/Master/Tree/Basic-Concept/Operate-Metadata_apache.md @@ -658,21 +658,28 @@ drop timeseries root.ln.wf02.*; ### 3.4 查看时间序列 -* SHOW LATEST? TIMESERIES pathPattern? timeseriesWhereClause? limitClause? +#### 1. 语法定义 - SHOW TIMESERIES 中可以有四种可选的子句,查询结果为这些时间序列的所有信息 - -时间序列信息具体包括:时间序列路径名,database,Measurement 别名,数据类型,编码方式,压缩方式,属性和标签。 +```sql +// ---- Show Timeseries +showTimeseries + : SHOW LATEST? TIMESERIES prefixPath? timeseriesWhereClause? timeConditionClause? orderByTimeseriesClause? rowPaginationClause? + ; +// order by timeseries for SHOW TIMESERIES +orderByTimeseriesClause + : ORDER BY TIMESERIES (ASC | DESC)? + ; +``` -示例: +时间序列查询结果具体包括:时间序列路径名,database,Measurement 别名,数据类型,编码方式,压缩方式,属性和标签等。 -* SHOW TIMESERIES +> 注意:V2.0.11 起支持查询结果按时间序列名称排序。 - 展示系统中所有的时间序列信息 +#### 2. 使用介绍 -* SHOW TIMESERIES <`Path`> +* **`SHOW TIMESERIES`**:展示系统中所有的时间序列信息 - 返回给定路径的下的所有时间序列信息。其中 `Path` 需要为一个时间序列路径或路径模式。例如,分别查看`root`路径和`root.ln`路径下的时间序列,SQL 语句如下所示: +* **`SHOW TIMESERIES `**:返回给定路径的下的所有时间序列信息。其中 `Path` 需要为一个时间序列路径或路径模式。例如,分别查看`root`路径和`root.ln`路径下的时间序列,SQL 语句如下所示: ```sql show timeseries root.**; @@ -708,17 +715,13 @@ Total line number = 4 It costs 0.004s ``` -* SHOW TIMESERIES LIMIT INT OFFSET INT - - 只返回从指定下标开始的结果,最大返回条数被 LIMIT 限制,用于分页查询。例如: +* **`SHOW TIMESERIES LIMIT INT OFFSET INT`**:只返回从指定下标开始的结果,最大返回条数被 LIMIT 限制,用于分页查询。例如: ```sql show timeseries root.ln.** limit 10 offset 10; ``` -* SHOW TIMESERIES WHERE TIMESERIES contains 'containStr' - - 对查询结果集根据 timeseries 名称进行字符串模糊匹配过滤。例如: +* **`SHOW TIMESERIES WHERE TIMESERIES contains 'containStr'`**:对查询结果集根据 timeseries 名称进行字符串模糊匹配过滤。例如: ```sql show timeseries root.ln.** where timeseries contains 'wf01.wt'; @@ -737,9 +740,7 @@ Total line number = 2 It costs 0.016s ``` -* SHOW TIMESERIES WHERE DataType=type - - 对查询结果集根据时间序列数据类型进行过滤。例如: +* **`SHOW TIMESERIES WHERE DataType=type`**:对查询结果集根据时间序列数据类型进行过滤。例如: ```sql show timeseries root.ln.** where dataType=FLOAT; @@ -761,10 +762,7 @@ It costs 0.016s ``` -* SHOW TIMESERIES WHERE TAGS(KEY) = VALUE -* SHOW TIMESERIES WHERE TAGS(KEY) CONTAINS VALUE - - 对查询结果集根据标签进行过滤。例如: +* **`SHOW TIMESERIES WHERE TAGS(KEY) = VALUE`** / **`SHOW TIMESERIES WHERE TAGS(KEY) CONTAINS VALUE`**:对查询结果集根据标签进行过滤。例如: ```sql show timeseries root.ln.** where TAGS(unit)='c'; @@ -791,12 +789,57 @@ Total line number = 1 It costs 0.004s ``` -* SHOW LATEST TIMESERIES +* **`SHOW LATEST TIMESERIES`**:表示查询出的时间序列需要按照最近插入时间戳降序排列。需要注意的是,当查询路径不存在时,系统会返回 0 条时间序列。 + +* **`SHOW INVALID TIMESERIES`**:自 V2.0.8 版本起,支持该 SQL 语句,用于展示修改全路径名称成功后的作废时间序列。 + +```sql +show invalid timeSeries +``` + +```shell ++-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+----------------------------------+ +| Timeseries|Alias|Database|DataType|Encoding|Compression|Tags|Attributes|Deadband|DeadbandParameters|ViewType| NewPath| ++-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+----------------------------------+ +|root.ln.wf01.wt01.temperature| null| root.ln| FLOAT| GORILLA| LZ4|null| null| null| null| BASE|root.newln.newwf.newwt.temperature| ++-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+----------------------------------+ +``` - 表示查询出的时间序列需要按照最近插入时间戳降序排列 +说明:返回结果中的最后一列 NewPath,展示作废序列对应的新序列,以服务于视图构建、集群迁移(Load+改名)等场景。 +* **`SHOW TIMESERIES ORDER BY TIMESERIES (ASC | DESC)`**:自 V2.0.11 版本起,支持查询结果按照序列名称排序。 -需要注意的是,当查询路径不存在时,系统会返回 0 条时间序列。 +```sql +-- 按序列名称倒序排序 +show timeseries root.ln.** order by timeseries desc +``` + +```shell ++-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+ +| Timeseries|Alias|Database|DataType|Encoding|Compression|Tags|Attributes|Deadband|DeadbandParameters|ViewType| ++-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+ +| root.ln.wf02.wt02.status| null| root.ln| BOOLEAN| RLE| LZ4|null| null| null| null| BASE| +| root.ln.wf02.wt02.hardware| null| root.ln| TEXT| PLAIN| LZ4|null| null| null| null| BASE| +|root.ln.wf01.wt01.temperature| null| root.ln| FLOAT| GORILLA| LZ4|null| null| null| null| BASE| +| root.ln.wf01.wt01.status| null| root.ln| BOOLEAN| RLE| LZ4|null| null| null| null| BASE| ++-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+ +``` + +```sql +--按序列名称正序排序 +show timeseries root.ln.** order by timeseries asc +``` + +```shell ++-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+ +| Timeseries|Alias|Database|DataType|Encoding|Compression|Tags|Attributes|Deadband|DeadbandParameters|ViewType| ++-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+ +| root.ln.wf01.wt01.status| null| root.ln| BOOLEAN| RLE| LZ4|null| null| null| null| BASE| +|root.ln.wf01.wt01.temperature| null| root.ln| FLOAT| GORILLA| LZ4|null| null| null| null| BASE| +| root.ln.wf02.wt02.hardware| null| root.ln| TEXT| PLAIN| LZ4|null| null| null| null| BASE| +| root.ln.wf02.wt02.status| null| root.ln| BOOLEAN| RLE| LZ4|null| null| null| null| BASE| ++-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+ +``` ### 3.5 统计时间序列总数 diff --git a/src/zh/UserGuide/latest/Basic-Concept/Operate-Metadata_apache.md b/src/zh/UserGuide/latest/Basic-Concept/Operate-Metadata_apache.md index 0b1aeadb6..2c2d452aa 100644 --- a/src/zh/UserGuide/latest/Basic-Concept/Operate-Metadata_apache.md +++ b/src/zh/UserGuide/latest/Basic-Concept/Operate-Metadata_apache.md @@ -658,21 +658,28 @@ drop timeseries root.ln.wf02.*; ### 3.4 查看时间序列 -* SHOW LATEST? TIMESERIES pathPattern? timeseriesWhereClause? limitClause? +#### 1. 语法定义 - SHOW TIMESERIES 中可以有四种可选的子句,查询结果为这些时间序列的所有信息 - -时间序列信息具体包括:时间序列路径名,database,Measurement 别名,数据类型,编码方式,压缩方式,属性和标签。 +```sql +// ---- Show Timeseries +showTimeseries + : SHOW LATEST? TIMESERIES prefixPath? timeseriesWhereClause? timeConditionClause? orderByTimeseriesClause? rowPaginationClause? + ; +// order by timeseries for SHOW TIMESERIES +orderByTimeseriesClause + : ORDER BY TIMESERIES (ASC | DESC)? + ; +``` -示例: +时间序列查询结果具体包括:时间序列路径名,database,Measurement 别名,数据类型,编码方式,压缩方式,属性和标签等。 -* SHOW TIMESERIES +> 注意:V2.0.11 起支持查询结果按时间序列名称排序。 - 展示系统中所有的时间序列信息 +#### 2. 使用介绍 -* SHOW TIMESERIES <`Path`> +* **`SHOW TIMESERIES`**:展示系统中所有的时间序列信息 - 返回给定路径的下的所有时间序列信息。其中 `Path` 需要为一个时间序列路径或路径模式。例如,分别查看`root`路径和`root.ln`路径下的时间序列,SQL 语句如下所示: +* **`SHOW TIMESERIES `**:返回给定路径的下的所有时间序列信息。其中 `Path` 需要为一个时间序列路径或路径模式。例如,分别查看`root`路径和`root.ln`路径下的时间序列,SQL 语句如下所示: ```sql show timeseries root.**; @@ -708,17 +715,13 @@ Total line number = 4 It costs 0.004s ``` -* SHOW TIMESERIES LIMIT INT OFFSET INT - - 只返回从指定下标开始的结果,最大返回条数被 LIMIT 限制,用于分页查询。例如: +* **`SHOW TIMESERIES LIMIT INT OFFSET INT`**:只返回从指定下标开始的结果,最大返回条数被 LIMIT 限制,用于分页查询。例如: ```sql show timeseries root.ln.** limit 10 offset 10; ``` -* SHOW TIMESERIES WHERE TIMESERIES contains 'containStr' - - 对查询结果集根据 timeseries 名称进行字符串模糊匹配过滤。例如: +* **`SHOW TIMESERIES WHERE TIMESERIES contains 'containStr'`**:对查询结果集根据 timeseries 名称进行字符串模糊匹配过滤。例如: ```sql show timeseries root.ln.** where timeseries contains 'wf01.wt'; @@ -737,9 +740,7 @@ Total line number = 2 It costs 0.016s ``` -* SHOW TIMESERIES WHERE DataType=type - - 对查询结果集根据时间序列数据类型进行过滤。例如: +* **`SHOW TIMESERIES WHERE DataType=type`**:对查询结果集根据时间序列数据类型进行过滤。例如: ```sql show timeseries root.ln.** where dataType=FLOAT; @@ -761,10 +762,7 @@ It costs 0.016s ``` -* SHOW TIMESERIES WHERE TAGS(KEY) = VALUE -* SHOW TIMESERIES WHERE TAGS(KEY) CONTAINS VALUE - - 对查询结果集根据标签进行过滤。例如: +* **`SHOW TIMESERIES WHERE TAGS(KEY) = VALUE`** / **`SHOW TIMESERIES WHERE TAGS(KEY) CONTAINS VALUE`**:对查询结果集根据标签进行过滤。例如: ```sql show timeseries root.ln.** where TAGS(unit)='c'; @@ -791,12 +789,57 @@ Total line number = 1 It costs 0.004s ``` -* SHOW LATEST TIMESERIES +* **`SHOW LATEST TIMESERIES`**:表示查询出的时间序列需要按照最近插入时间戳降序排列。需要注意的是,当查询路径不存在时,系统会返回 0 条时间序列。 + +* **`SHOW INVALID TIMESERIES`**:自 V2.0.8 版本起,支持该 SQL 语句,用于展示修改全路径名称成功后的作废时间序列。 + +```sql +show invalid timeSeries +``` + +```shell ++-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+----------------------------------+ +| Timeseries|Alias|Database|DataType|Encoding|Compression|Tags|Attributes|Deadband|DeadbandParameters|ViewType| NewPath| ++-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+----------------------------------+ +|root.ln.wf01.wt01.temperature| null| root.ln| FLOAT| GORILLA| LZ4|null| null| null| null| BASE|root.newln.newwf.newwt.temperature| ++-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+----------------------------------+ +``` - 表示查询出的时间序列需要按照最近插入时间戳降序排列 +说明:返回结果中的最后一列 NewPath,展示作废序列对应的新序列,以服务于视图构建、集群迁移(Load+改名)等场景。 +* **`SHOW TIMESERIES ORDER BY TIMESERIES (ASC | DESC)`**:自 V2.0.11 版本起,支持查询结果按照序列名称排序。 -需要注意的是,当查询路径不存在时,系统会返回 0 条时间序列。 +```sql +-- 按序列名称倒序排序 +show timeseries root.ln.** order by timeseries desc +``` + +```shell ++-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+ +| Timeseries|Alias|Database|DataType|Encoding|Compression|Tags|Attributes|Deadband|DeadbandParameters|ViewType| ++-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+ +| root.ln.wf02.wt02.status| null| root.ln| BOOLEAN| RLE| LZ4|null| null| null| null| BASE| +| root.ln.wf02.wt02.hardware| null| root.ln| TEXT| PLAIN| LZ4|null| null| null| null| BASE| +|root.ln.wf01.wt01.temperature| null| root.ln| FLOAT| GORILLA| LZ4|null| null| null| null| BASE| +| root.ln.wf01.wt01.status| null| root.ln| BOOLEAN| RLE| LZ4|null| null| null| null| BASE| ++-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+ +``` + +```sql +--按序列名称正序排序 +show timeseries root.ln.** order by timeseries asc +``` + +```shell ++-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+ +| Timeseries|Alias|Database|DataType|Encoding|Compression|Tags|Attributes|Deadband|DeadbandParameters|ViewType| ++-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+ +| root.ln.wf01.wt01.status| null| root.ln| BOOLEAN| RLE| LZ4|null| null| null| null| BASE| +|root.ln.wf01.wt01.temperature| null| root.ln| FLOAT| GORILLA| LZ4|null| null| null| null| BASE| +| root.ln.wf02.wt02.hardware| null| root.ln| TEXT| PLAIN| LZ4|null| null| null| null| BASE| +| root.ln.wf02.wt02.status| null| root.ln| BOOLEAN| RLE| LZ4|null| null| null| null| BASE| ++-----------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+ +``` ### 3.5 统计时间序列总数