Skip to content

Commit

Permalink
add a description of database and a tiered-store parameter description (
Browse files Browse the repository at this point in the history
  • Loading branch information
wanghui42 authored Jan 18, 2024
1 parent b3de5f2 commit 0398b6b
Show file tree
Hide file tree
Showing 16 changed files with 108 additions and 84 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ It is information measured by detection equipment in an actual scene and can tra

**A group of entities.** Users can create any prefix path as a database. Provided that there are four timeseries `root.ln.wf01.wt01.status`, `root.ln.wf01.wt01.temperature`, `root.ln.wf02.wt02.hardware`, `root.ln.wf02.wt02.status`, two devices `wt01`, `wt02` under the path `root.ln` may belong to the same owner or the same manufacturer, so d1 and d2 are closely related. At this point, the prefix path root.vehicle can be designated as a database, which will enable IoTDB to store all devices under it in the same folder. Newly added devices under `root.ln` will also belong to this database.

In general, it is recommended to create 1 database.

> Note1: A full path (`root.ln.wf01.wt01.status` as in the above example) is not allowed to be set as a database.
>
> Note2: The prefix of a timeseries must belong to a database. Before creating a timeseries, users must set which database the series belongs to. Only timeseries whose database is set can be persisted to disk.
Expand Down
123 changes: 49 additions & 74 deletions src/UserGuide/Master/User-Manual/Operate-Metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ IoTDB > create database root.sgcc

We can thus create two databases using the above two SQL statements.

It is worth noting that when the path itself or the parent/child layer of the path is already created as database, the path is then not allowed to be created as database. For example, it is not feasible to create `root.ln.wf01` as database when two databases `root.ln` and `root.sgcc` exist. The system gives the corresponding error prompt as shown below:
It is worth noting that 1 database is recommended.

When the path itself or the parent/child layer of the path is already created as database, the path is then not allowed to be created as database. For example, it is not feasible to create `root.ln.wf01` as database when two databases `root.ln` and `root.sgcc` exist. The system gives the corresponding error prompt as shown below:

```
IoTDB> CREATE DATABASE root.ln.wf01
Expand All @@ -45,6 +47,8 @@ Msg: 300: root.ln has already been created as database.

The LayerName of database can only be characters, numbers, underscores. If you want to set it to pure numbers or contain other characters, you need to enclose the database name with backticks (``).

Time series path supports the creation of hierarchical paths containing "*" for paths other than the database level, e.g. root.db.`*`.

Besides, if deploy on Windows system, the LayerName is case-insensitive, which means it's not allowed to create databases `root.ln` and `root.LN` at the same time.

### Show Databases
Expand Down Expand Up @@ -317,7 +321,7 @@ Note: The `schema` keyword in the following statements can be omitted.

### Create Schema Template

The SQL syntax for creating a schema template is as follows:
The SQL syntax for creating a metadata template is as follows:

```sql
CREATE SCHEMA TEMPLATE <templateName> ALIGNED? '(' <measurementId> <attributeClauses> [',' <measurementId> <attributeClauses>]+ ')'
Expand Down Expand Up @@ -397,12 +401,12 @@ show devices root.sg1.**
````
```shell
+---------------+---------+---------+
| devices|isAligned| Template|
+---------------+---------+---------+
| root.sg1.d1| false| null|
| root.sg1.d2| true| null|
+---------------+---------+---------+
+---------------+---------+
| devices|isAligned|
+---------------+---------+
| root.sg1.d1| false|
| root.sg1.d2| true|
+---------------+---------+
````

### Show Schema Template
Expand Down Expand Up @@ -1092,69 +1096,40 @@ Similar to `Show Timeseries`, IoTDB also supports two ways of viewing devices:
* `SHOW DEVICES` statement presents all devices' information, which is equal to `SHOW DEVICES root.**`.
* `SHOW DEVICES <PathPattern>` statement specifies the `PathPattern` and returns the devices information matching the pathPattern and under the given level.
* `WHERE` condition supports `DEVICE contains 'xxx'` to do a fuzzy query based on the device name.
* `WHERE` condition supports `TEMPLATE = 'xxx'`,`TEMPLATE != 'xxx'` to do a filter query based on the template name.
* `WHERE` condition supports `TEMPLATE is null`,`TEMPLATE is not null` to do a filter query based on whether the template is null (null indicating it's inactive)
SQL statement is as follows:
```
IoTDB> show devices
IoTDB> show devices root.ln.**
IoTDB> show devices root.ln.** where device contains 't'
IoTDB> show devices root.ln.** where template = 't1'
IoTDB> show devices root.ln.** where template is null
```
You can get results below:
```
+-------------------+---------+---------+
| devices|isAligned| Template|
+-------------------+---------+---------+
| root.ln.wf01.wt01| false| t1|
| root.ln.wf02.wt02| false| null|
|root.sgcc.wf03.wt01| false| null|
| root.turbine.d1| false| null|
+-------------------+---------+---------+
+-------------------+---------+
| devices|isAligned|
+-------------------+---------+
| root.ln.wf01.wt01| false|
| root.ln.wf02.wt02| false|
|root.sgcc.wf03.wt01| false|
| root.turbine.d1| false|
+-------------------+---------+
Total line number = 4
It costs 0.002s

+-----------------+---------+---------+
| devices|isAligned| Template|
+-----------------+---------+---------+
|root.ln.wf01.wt01| false| t1|
|root.ln.wf02.wt02| false| null|
+-----------------+---------+---------+
Total line number = 2
It costs 0.001s

+-----------------+---------+---------+
| devices|isAligned| Template|
+-----------------+---------+---------+
|root.ln.wf01.wt01| false| t1|
|root.ln.wf02.wt02| false| null|
+-----------------+---------+---------+
+-----------------+---------+
| devices|isAligned|
+-----------------+---------+
|root.ln.wf01.wt01| false|
|root.ln.wf02.wt02| false|
+-----------------+---------+
Total line number = 2
It costs 0.001s

+-----------------+---------+---------+
| devices|isAligned| Template|
+-----------------+---------+---------+
|root.ln.wf01.wt01| false| t1|
+-----------------+---------+---------+
Total line number = 1
It costs 0.001s

+-----------------+---------+---------+
| devices|isAligned| Template|
+-----------------+---------+---------+
|root.ln.wf02.wt02| false| null|
+-----------------+---------+---------+
Total line number = 1
It costs 0.001s
```
`isAligned` indicates whether the timeseries under the device are aligned, `Template` displays the name of the template activated on the device, with `null` indicating that no template has been activated.
`isAligned` indicates whether the timeseries under the device are aligned.
To view devices' information with database, we can use `SHOW DEVICES WITH DATABASE` statement.
Expand All @@ -1172,23 +1147,23 @@ IoTDB> show devices root.ln.** with database
You can get results below:
```
+-------------------+-------------+---------+---------+
| devices| database|isAligned| Template|
+-------------------+-------------+---------+---------+
| root.ln.wf01.wt01| root.ln| false| t1|
| root.ln.wf02.wt02| root.ln| false| null|
|root.sgcc.wf03.wt01| root.sgcc| false| null|
| root.turbine.d1| root.turbine| false| null|
+-------------------+-------------+---------+---------+
+-------------------+-------------+---------+
| devices| database|isAligned|
+-------------------+-------------+---------+
| root.ln.wf01.wt01| root.ln| false|
| root.ln.wf02.wt02| root.ln| false|
|root.sgcc.wf03.wt01| root.sgcc| false|
| root.turbine.d1| root.turbine| false|
+-------------------+-------------+---------+
Total line number = 4
It costs 0.003s

+-----------------+-------------+---------+---------+
| devices| database|isAligned| Template|
+-----------------+-------------+---------+---------+
|root.ln.wf01.wt01| root.ln| false| t1|
|root.ln.wf02.wt02| root.ln| false| null|
+-----------------+-------------+---------+---------+
+-----------------+-------------+---------+
| devices| database|isAligned|
+-----------------+-------------+---------+
|root.ln.wf01.wt01| root.ln| false|
|root.ln.wf02.wt02| root.ln| false|
+-----------------+-------------+---------+
Total line number = 2
It costs 0.001s
```
Expand All @@ -1210,14 +1185,14 @@ IoTDB> count devices root.ln.**
You can get results below:
```
+-------------------+---------+---------+
| devices|isAligned| Template|
+-------------------+---------+---------+
|root.sgcc.wf03.wt03| false| null|
| root.turbine.d1| false| null|
| root.ln.wf02.wt02| false| null|
| root.ln.wf01.wt01| false| t1|
+-------------------+---------+---------+
+-------------------+---------+
| devices|isAligned|
+-------------------+---------+
|root.sgcc.wf03.wt03| false|
| root.turbine.d1| false|
| root.ln.wf02.wt02| false|
| root.ln.wf01.wt01| false|
+-------------------+---------+
Total line number = 4
It costs 0.024s

Expand Down
3 changes: 3 additions & 0 deletions src/UserGuide/Master/User-Manual/Syntax-Rule.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,9 @@ Examples of case in which quoted identifier is used :
```

- The key/value of an attribute can be String Literal and identifier, more details can be found at **key-value pair** part.

- Time series path supports the creation of hierarchical paths containing "*" for paths other than the database level, e.g. root.db.`*`.


## KeyWords Words

Expand Down
2 changes: 1 addition & 1 deletion src/UserGuide/Master/User-Manual/Tiered-Storage_timecho.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ The specific parameter definitions and their descriptions are as follows.
| Configuration | Default | Description | Constraint |
| ---------------------------------------- | ------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
| dn_data_dirs | None | specify different storage directories and divide the storage directories into tiers | Each level of storage uses a semicolon to separate, and commas to separate within a single level; cloud (OBJECT_STORAGE) configuration can only be used as the last level of storage and the first level can't be used as cloud storage; a cloud object at most; the remote storage directory is denoted by OBJECT_STORAGE |
| default_ttl_in_ms | None | Define the maximum age of data for which each tier is responsible | Each level of storage is separated by a semicolon; the number of levels should match the number of levels defined by dn_data_dirs |
| default_ttl_in_ms | None | Define the maximum age of data for which each tier is responsible | Each level of storage is separated by a semicolon; the number of levels should match the number of levels defined by dn_data_dirs;"-1" means "unlimited". |
| dn_default_space_move_thresholds | 0.15 | Define the minimum remaining space ratio for each tier data catalogue; when the remaining space is less than this ratio, the data will be automatically migrated to the next tier; when the remaining storage space of the last tier falls below this threshold, the system will be set to READ_ONLY | Each level of storage is separated by a semicolon; the number of levels should match the number of levels defined by dn_data_dirs |
| object_storage_type | AWS_S3 | Cloud Storage Type | IoTDB currently only supports AWS S3 as a remote storage type, and this parameter can't be modified |
| object_storage_bucket | None | Name of cloud storage bucket | Bucket definition in AWS S3; no need to configure if remote storage is not used |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ It is information measured by detection equipment in an actual scene and can tra

**A group of entities.** Users can create any prefix path as a database. Provided that there are four timeseries `root.ln.wf01.wt01.status`, `root.ln.wf01.wt01.temperature`, `root.ln.wf02.wt02.hardware`, `root.ln.wf02.wt02.status`, two devices `wt01`, `wt02` under the path `root.ln` may belong to the same owner or the same manufacturer, so d1 and d2 are closely related. At this point, the prefix path root.vehicle can be designated as a database, which will enable IoTDB to store all devices under it in the same folder. Newly added devices under `root.ln` will also belong to this database.

In general, it is recommended to create 1 database.

> Note1: A full path (`root.ln.wf01.wt01.status` as in the above example) is not allowed to be set as a database.
>
> Note2: The prefix of a timeseries must belong to a database. Before creating a timeseries, users must set which database the series belongs to. Only timeseries whose database is set can be persisted to disk.
Expand Down
4 changes: 3 additions & 1 deletion src/UserGuide/latest/User-Manual/Operate-Metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ IoTDB > create database root.sgcc

We can thus create two databases using the above two SQL statements.

It is worth noting that when the path itself or the parent/child layer of the path is already created as database, the path is then not allowed to be created as database. For example, it is not feasible to create `root.ln.wf01` as database when two databases `root.ln` and `root.sgcc` exist. The system gives the corresponding error prompt as shown below:
It is worth noting that 1 database is recommended.

When the path itself or the parent/child layer of the path is already created as database, the path is then not allowed to be created as database. For example, it is not feasible to create `root.ln.wf01` as database when two databases `root.ln` and `root.sgcc` exist. The system gives the corresponding error prompt as shown below:

```
IoTDB> CREATE DATABASE root.ln.wf01
Expand Down
3 changes: 3 additions & 0 deletions src/UserGuide/latest/User-Manual/Syntax-Rule.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,9 @@ Examples of case in which quoted identifier is used :
```

- The key/value of an attribute can be String Literal and identifier, more details can be found at **key-value pair** part.

- Time series path supports the creation of hierarchical paths containing "*" for paths other than the database level, e.g. root.db.`*`.


## KeyWords Words

Expand Down
2 changes: 1 addition & 1 deletion src/UserGuide/latest/User-Manual/Tiered-Storage_timecho.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ The specific parameter definitions and their descriptions are as follows.
| Configuration | Default | Description | Constraint |
| ---------------------------------------- | ------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
| dn_data_dirs | None | specify different storage directories and divide the storage directories into tiers | Each level of storage uses a semicolon to separate, and commas to separate within a single level; cloud (OBJECT_STORAGE) configuration can only be used as the last level of storage and the first level can't be used as cloud storage; a cloud object at most; the remote storage directory is denoted by OBJECT_STORAGE |
| default_ttl_in_ms | None | Define the maximum age of data for which each tier is responsible | Each level of storage is separated by a semicolon; the number of levels should match the number of levels defined by dn_data_dirs |
| default_ttl_in_ms | None | Define the maximum age of data for which each tier is responsible | Each level of storage is separated by a semicolon; the number of levels should match the number of levels defined by dn_data_dirs;"-1" means "unlimited". |
| dn_default_space_move_thresholds | 0.15 | Define the minimum remaining space ratio for each tier data catalogue; when the remaining space is less than this ratio, the data will be automatically migrated to the next tier; when the remaining storage space of the last tier falls below this threshold, the system will be set to READ_ONLY | Each level of storage is separated by a semicolon; the number of levels should match the number of levels defined by dn_data_dirs |
| object_storage_type | AWS_S3 | Cloud Storage Type | IoTDB currently only supports AWS S3 as a remote storage type, and this parameter can't be modified |
| object_storage_bucket | None | Name of cloud storage bucket | Bucket definition in AWS S3; no need to configure if remote storage is not used |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ IoTDB 模型结构涉及的基本概念在下文将做详细叙述。

用户可以将任意前缀路径设置成数据库。如有 4 条时间序列`root.ln.wf01.wt01.status`, `root.ln.wf01.wt01.temperature`, `root.ln.wf02.wt02.hardware`, `root.ln.wf02.wt02.status`,路径`root.ln`下的两个实体 `wt01`, `wt02`可能属于同一个业主,或者同一个制造商,这时候就可以将前缀路径`root.ln`指定为一个数据库。未来`root.ln`下增加了新的实体,也将属于该数据库。

一个 database 中的所有数据会存储在同一批文件夹下,不同 database 的数据会存储在磁盘的不同文件夹下,从而实现物理隔离。
一个 database 中的所有数据会存储在同一批文件夹下,不同 database 的数据会存储在磁盘的不同文件夹下,从而实现物理隔离。一般情况下建议设置 1 个 database。

> 注意 1:不允许将一个完整路径(如上例的`root.ln.wf01.wt01.status`) 设置成 database。
>
Expand Down
4 changes: 3 additions & 1 deletion src/zh/UserGuide/Master/User-Manual/Operate-Metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
IoTDB > CREATE DATABASE root.ln
```

需要注意的是,database 的父子节点都不能再设置 database。例如在已经有`root.ln``root.sgcc`这两个 database 的情况下,创建`root.ln.wf01` database 是不可行的。系统将给出相应的错误提示,如下所示:
需要注意的是,推荐创建一个 database.

Database 的父子节点都不能再设置 database。例如在已经有`root.ln``root.sgcc`这两个 database 的情况下,创建`root.ln.wf01` database 是不可行的。系统将给出相应的错误提示,如下所示:

```
IoTDB> CREATE DATABASE root.ln.wf01
Expand Down
3 changes: 3 additions & 0 deletions src/zh/UserGuide/Master/User-Manual/Syntax-Rule.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,9 @@ create schema template `t1't"t`
```

- 用于表示键值对,键值对的键和值可以被定义成常量(包括字符串)或者标识符,具体请参考键值对章节。

- 时间序列路径中对于 database 级别以外的层级路径支持含有"*"创建,如 root.db.`*`


## 关键字

Expand Down
Loading

0 comments on commit 0398b6b

Please sign in to comment.