Auto create metadata
Automatically creating schema means creating time series based on the characteristics of written data in case time series haven’t defined by users themselves. This function can not only solve the problem that entities and measurements are difficult to predict and model in advance under massive time series scenarios, but also provide users with an out-of-the-box writing experience.
Auto create storage group metadata
- enable_auto_create_schema
Name | enable_auto_create_schema |
---|---|
Description | whether creating schema automatically is enabled |
Type | boolean |
Default | true |
Effective | After restarting system |
- default_storage_group_level
Name | default_storage_group_level |
---|---|
Description | Specify which level storage group is in the time series, the default level is 1 (root is on level 0) |
Type | int |
Default | 1 |
Effective | Only allowed to be modified in first start up |
Illustrated as the following figure:
When default_storage_group_level=1, root.turbine1 and root.turbine2 will be set as storage group.
When default_storage_group_level=2, root.turbine1.d1, root.turbine1.d2, root.turbine2.d1 and root.turbine2.d2 will be set as storage group.
Auto create time series metadata(specify data type in the frontend)
Users should specify data type when writing:
- insertTablet method in Session module.
insert method using TSDataType in Session module.
public void insertRecord(String deviceId, long time, List<String> measurements, List<TSDataType> types, Object... values);
public void insertRecords(List<String> deviceIds, List<Long> times, List<List<String>> measurementsList, List<List<TSDataType>> typesList, List<List<Object>> valuesList);
……
- Efficient, time series are auto created when inserting data.
Auto create time series metadata(infer data type in the backend)
Just pass string, and the database will infer the data type:
- insert command in CLI module.
insert method without using TSDataType in Session module.
public void insertRecord(String deviceId, long time, List<String> measurements, List<TSDataType> types, List<Object> values);
public void insertRecords(List<String> deviceIds, List<Long> times, List<List<String>> measurementsList, List<List<String>> valuesList);
……
- Since type inference will increase the writing time, the efficiency of auto creating time series metadata through type inference is lower than that of auto creating time series metadata through specifying data type. We recommend users choose specifying data type in the frontend when possible.
Type inference
Data(String Format) | Format Type | iotdb-engine.properties | Default |
---|---|---|---|
true | boolean | boolean_string_infer_type | BOOLEAN |
1 | integer | integer_string_infer_type | FLOAT |
17000000(integer > 2^24) | integer | long_string_infer_type | DOUBLE |
1.2 | floating | floating_string_infer_type | FLOAT |
NaN | nan | nan_string_infer_type | DOUBLE |
‘I am text’ | text | x | x |
Data types can be configured as BOOLEAN, INT32, INT64, FLOAT, DOUBLE, TEXT.
long_string_infer_type is used to avoid precision loss caused by using integer_string_infer_type=FLOAT to infer num > 2^24.
Encoding Type
Data Type | iotdb-engine.properties | Default |
---|---|---|
BOOLEAN | default_boolean_encoding | RLE |
INT32 | default_int32_encoding | RLE |
INT64 | default_int64_encoding | RLE |
FLOAT | default_float_encoding | GORILLA |
DOUBLE | default_double_encoding | GORILLA |
TEXT | default_text_encoding | PLAIN |
Encoding types can be configured as PLAIN, RLE, TS_2DIFF, GORILLA, DICTIONARY.
The corresponding relationship between data types and encoding types is detailed in Encoding.