After enter, this command will automatically create a super table `meters` under the database test, there are 10,000 tables under this super table, the table name is "d0" to "d9999", each table has 10,000 records, each record has four fields (ts, current, voltage, phase), the time stamp is from "2017-07-14 10:40:00 000" to "2017-07-14 10:40:09 999", each table has a tag location and groupId, groupId is set from 1 to 10 and location is set to "beijing" or "shanghai".
After enter, this command will automatically create a super table `meters` under the database test, there are 10,000 tables under this super table, the table name is "d0" to "d9999", each table has 10,000 records, each record has four fields (ts, current, voltage, phase), the time stamp is from "2017-07-14 10:40:00 000" to "2017-07-14 10:40:09 999", each table has a tag location and groupid, groupid is set from 1 to 10 and location is set to "beijing" or "shanghai".
It takes about a few minutes to execute this command and ends up inserting a total of 100 million records.
@@ -863,7 +863,9 @@ TDengine supports aggregations over data, they are listed below:
Applicable Fields: All types except timestamp.
Supported version: Version after 2.6.0 .
Note: Since the amount of returned data is unknown, considering the memory factor, in order to return the result normally, it is recommended that the amount of non repeated data is 100000, otherwise an error will be reported.
Example:
```mysql
taos> select voltage from d002;
...
...
@@ -886,7 +888,9 @@ TDengine supports aggregations over data, they are listed below:
```mysql
SELECT HYPERLOGLOG(field_name) FROM { tb_name | stb_name } [WHERE clause];
```
Function: The hyperloglog algorithm is used to return the cardinality of a column. In the case of large amount of data, the algorithm can significantly reduce the occupation of memory, but the cardinality is an estimated value, and the standard error is 0.81%.
Function:
- The hyperloglog algorithm is used to return the cardinality of a column. In the case of large amount of data, the algorithm can significantly reduce the occupation of memory, but the cardinality is an estimated value, and the standard error(the standard error is the standard deviation of the average of multiple experiments, not the error with the real result) is 0.81%.
- When the amount of data is small, the algorithm is not very accurate. You can use the method like this: select count(data) from (select unique(col) as data from table).
Return Data Type:Integer.
...
...
@@ -1215,8 +1219,10 @@ TDengine supports aggregations over data, they are listed below:
Supported version: Version after 2.6.0 .
Note: This function can be applied to ordinary tables and super tables. Cannot be used with window operations,such as interval/state_window/session_window.
Note:
- This function can be applied to ordinary tables and super tables. Cannot be used with window operations,such as interval/state_window/session_window.
- Since the amount of returned data is unknown, considering the memory factor, in order to return the result normally, it is recommended that the amount of non repeated data is 100000, otherwise an error will be reported.
Example:
```mysql
taos> select ts,voltage from unique1;
...
...
@@ -1296,6 +1302,412 @@ TDengine supports aggregations over data, they are listed below:
Query OK, 1 row(s) in set (0.000836s)
```
-**ASIN**
```mysql
SELECT ASIN(field_name) FROM { tb_name | stb_name } [WHERE clause]
```
Function: Returns the arc-sine of the input value.
Output Data Type: DOUBLE.
Input: applies to value of all types except timestamp, binary, nchar, and bool. Can not apply to tag column of super table.
Embedded Query Support: Both Outer Query and Inner Query
Notes:
If input value is NULL, the output value is NULL.
It is a scalar function and can not be used together with aggregate function
Applies to columns of normal table, child table and super table
Supported after version 2.6.0.x
-**ACOS**
```mysql
SELECT ACOS(field_name) FROM { tb_name | stb_name } [WHERE clause]
```
Function: Returns the arc-cosine of the input value.
Output Data Type: DOUBLE.
Input: applies to value of all types except timestamp, binary, nchar, and bool. Can not apply to tag column of super table.
Embedded Query Support: Both Outer Query and Inner Query
Notes:
If input value is NULL, the output value is NULL.
It is a scalar function and can not be used together with aggregate function
Applies to columns of normal table, child table and super table
Supported after version 2.6.0.x
-**ATAN**
```mysql
SELECT ATAN(field_name) FROM { tb_name | stb_name } [WHERE clause]
```
Function: Returns the arc-tangent of the input value.
Output Data Type: DOUBLE.
Input: applies to value of all types except timestamp, binary, nchar, and bool. Can not apply to tag column of super table.
Embedded Query Support: Both Outer Query and Inner Query
Notes:
If input value is NULL, the output value is NULL.
It is a scalar function and can not be used together with aggregate function
Applies to columns of normal table, child table and super table
Supported after version 2.6.0.x
-**SIN**
```mysql
SELECT SIN(field_name) FROM { tb_name | stb_name } [WHERE clause]
```
Function: Returns the sine of the input value.
Output Data Type: DOUBLE.
Input: applies to value of all types except timestamp, binary, nchar, and bool. Can not apply to tag column of super table.
Embedded Query Support: Both Outer Query and Inner Query
Notes:
If input value is NULL, the output value is NULL.
It is a scalar function and can not be used together with aggregate function
Applies to columns of normal table, child table and super table
Supported after version 2.6.0.x
-**COS**
```mysql
SELECT COS(field_name) FROM { tb_name | stb_name } [WHERE clause]
```
Function: Returns the cosine of the input value.
Output Data Type: DOUBLE.
Input: applies to value of all types except timestamp, binary, nchar, and bool. Can not apply to tag column of super table.
Embedded Query Support: Both Outer Query and Inner Query
Notes:
If input value is NULL, the output value is NULL.
It is a scalar function and can not be used together with aggregate function
Applies to columns of normal table, child table and super table
Supported after version 2.6.0.x
-**TAN**
```mysql
SELECT TAN(field_name) FROM { tb_name | stb_name } [WHERE clause]
```
Function: Returns the tangent of the input value.
Output Data Type: DOUBLE.
Input: applies to value of all types except timestamp, binary, nchar, and bool. Can not apply to tag column of super table.
Embedded Query Support: Both Outer Query and Inner Query
Notes:
If input value is NULL, the output value is NULL.
It is a scalar function and can not be used together with aggregate function
Applies to columns of normal table, child table and super table
Function: Returns the logarithm of the input value with base
Output Data Type: DOUBLE.
Input: applies to value of all types except timestamp, binary, nchar, and bool. Can not apply to tag column of super table.
Embedded Query Support: Both Outer Query and Inner Query
Notes:
If input value is NULL, the output value is NULL.
It is a scalar function and can not be used together with aggregate function
Applies to columns of normal table, child table and super table
Supported after version 2.6.0.x
-**ABS**
```mysql
SELECT ABS(field_name) FROM { tb_name | stb_name } [WHERE clause]
```
Function: Returns the absolute value of the input value
Output Data Type: If the input data is an integer numeric value, the output data type is ubigint. If the input data is a float or double value, the output data type is double
Input: applies to value of all types except timestamp, binary, nchar, and bool. Can not apply to tag column of super table.
Embedded Query Support: Both Outer Query and Inner Query
Notes:
If input value is NULL, the output value is NULL.
It is a scalar function and can not be used together with aggregate function
Applies to columns of normal table, child table and super table
Supported after version 2.6.0.x
-**SQRT**
```mysql
SELECT SQRT(field_name) FROM { tb_name | stb_name } [WHERE clause]
```
Function: Returns the square root value of the input value
Output Data Type: DOUBLE.
Input: applies to value of all types except timestamp, binary, nchar, and bool. Can not apply to tag column of super table.
Embedded Query Support: Both Outer Query and Inner Query
Notes:
If input value is NULL, the output value is NULL.
It is a scalar function and can not be used together with aggregate function
Applies to columns of normal table, child table and super table
Supported after version 2.6.0.x
-**CAST**
```mysql
SELECT CAST(expression AS type_name) FROM { tb_name | stb_name } [WHERE clause]
```
Function: Converts a value into as a specific data type of type_name.
Output Data Type: type_name specificied. Supported types include BIGINT, BINARY(N), TIMESTAMP and NCHAR(N) and BIGINT UNSIGNED
Input: Normal column, constant, scalar function and the arithmetic computation(+,-,*,/,%) among them. Input data type includes BOOL, TINYINT, SMALLINT, INT, BIGINT, FLOAT, DOUBLE, BINARY(M), TIMESTAMP, NCHAR(M), TINYINT UNSIGNED, SMALLINT UNSIGNED, INT UNSIGNED, and BIGINT UNSIGNED
Notes:
Reports error for unsupported cast
It is a scalar function and its output is NULL for input NULL
Function: Returns the string from concatenating the arguments with separator.
Output Data Type: With binary inputs, the output data type is binary. With nchar inputs, the output data type is nchar.
Input: all inputs shall be of data type binary or nchar. Can not apply to tag columns.
Notes:
Returns NULL when the separator is NULL. If the separator is not NULL and all the other string values are NULL, the result is an empty string.
The function takes 3 to 9 string values as input. all inputs must be of the same data type.
This function applies to normal table, child table and super table
This function applies to bother out query and inner query
Supported after version 2.6.0.x
-**LENGTH**
```
SELECT LENGTH(str|column) FROM { tb_name | stb_name } [WHERE clause]
```
Function: Returns the length of the string measure in bytes
Output Data Type: INT。
Input: BINARY or NCHAR values. Can not apply to tag columns
Notes:
Returns NULL when input is NULL.
This function applies to normal table, child table and super table
This function applies to bother out query and inner query
Supported after version 2.6.0.x
-**CHAR_LENGTH**
```
SELECT CHAR_LENGTH(str|column) FROM { tb_name | stb_name } [WHERE clause]
```
Function: Returns the length of the string measure in characters
Output Data Type: INT。
Input: BINARY or NCHAR values. Can not apply to tag columns
Notes:
Returns NULL when input is NULL.
This function applies to normal table, child table and super table
This function applies to bother out query and inner query
Supported after version 2.6.0.x
-**LOWER**
```
SELECT LOWER(str|column) FROM { tb_name | stb_name } [WHERE clause]
```
Function: Returns the lower case of input value
Output Data Type: BINARY or NCHAR. Same data type as Input.
Input: BINARY or NCHAR values. Can not apply to tag columns
Notes:
Returns NULL when input is NULL.
This function applies to normal table, child table and super table
This function applies to bother out query and inner query
Supported after version 2.6.0.x
-**UPPER**
```
SELECT UPPER(str|column) FROM { tb_name | stb_name } [WHERE clause]
```
Function: Returns the upper case of input value
Output Data Type: BINARY or NCHAR. Same data type as Input.
Input: BINARY or NCHAR values. Can not apply to tag columns
Notes:
Returns NULL when input is NULL.
This function applies to normal table, child table and super table
This function applies to bother out query and inner query
Supported after version 2.6.0.x
-**LTRIM**
```
SELECT LTRIM(str|column) FROM { tb_name | stb_name } [WHERE clause]
```
Function: removes leading spaces from a string
Output Data Type: BINARY or NCHAR. Same data type as Input.
Input: BINARY or NCHAR values. Can not apply to tag columns
Notes:
Returns NULL when input is NULL.
This function applies to normal table, child table and super table
This function applies to bother out query and inner query
Supported after version 2.6.0.x
-**RTRIM**
```
SELECT RTRIM(str|column) FROM { tb_name | stb_name } [WHERE clause]
```
Function: removes trailing spaces from a string
Output Data Type: BINARY or NCHAR. Same data type as Input.
Input: BINARY or NCHAR values. Can not apply to tag columns
Notes:
Returns NULL when input is NULL.
This function applies to normal table, child table and super table
This function applies to bother out query and inner query
Supported after version 2.6.0.x
-**SUBSTR**
```
SELECT SUBSTR(str,pos[,len]) FROM { tb_name | stb_name } [WHERE clause]
```
Function: extracts substring from a string str, starting from pos and extracting len characters.
Output Data Type: BINARY or NCHAR. Same data type as Input.
Input: BINARY or NCHAR values. Can not apply to tag columns
Notes:
Returns NULL when input is NULL.
Input pos can be negative or positive. If it is a positive number, this function extracts from the beginning of the string. If it is a negative number, this function extracts from the end of the string
If input len is ommited, the output is whole substring starting from pos.
This function applies to normal table, child table and super table
This function applies to bother out query and inner query
@@ -63,7 +63,7 @@ This allows collectd to push the data to taosAdapter using the push to OpenTSDB
After the data has been written to TDengine properly, you can adapt Grafana to visualize the data written to TDengine. There is a connection plugin for Grafana in the TDengine installation directory connector/grafanaplugin. The way to use this plugin is simple.
First copy the entire dist directory under the grafanaplugin directory to Grafana's plugins directory (the default address is /var/lib/grafana/plugins/), and then restart Grafana to see the TDengine data source under the Add Data Source menu.
First copy the entire `dist` directory under the grafanaplugin directory to Grafana's plugins directory (the default address is /var/lib/grafana/plugins/), and then restart Grafana to see the TDengine data source under the Add Data Source menu.
```shell
sudo cp-r. /var/lib/grafana/plugins/tdengine
...
...
@@ -144,15 +144,15 @@ The steps are as follows: the name of the metrics is used as the name of the TDe
Eventually about 340 sub-tables and 3 super-tables will be created in the system. Note that if the use of concatenated tagged values causes the sub-table names to exceed the system limit (191 bytes), then some encoding (e.g. MD5) needs to be used to convert them to an acceptable length.
...
...
@@ -168,7 +168,7 @@ Data is subscribed from the message queue and an adapted writer is started to wr
After the data starts to be written for a sustained period, SQL statements can be used to check whether the amount of data written meets the expected write requirements. The following SQL statement is used to count the amount of data.
```sql
selectcount(*)frommemory
SELECTCOUNT(*)FROMmemory
```
After completing the query, if the written data does not differ from the expected one, and there are no abnormal error messages from the writing program itself, then you can confirm that the data writing is complete and valid.
...
...
@@ -213,7 +213,7 @@ Notes.
1. the value within the Interval needs to be the same as the interval value of the outer query.
As the interpolation of values in OpenTSDB uses linear interpolation, use fill(linear) to declare the interpolation type in the interpolation clause. The following functions with the same interpolation requirements are handled by this method. 3.
As the interpolation of values in OpenTSDB uses linear interpolation, use FILL(linear) to declare the interpolation type in the interpolation clause. The following functions with the same interpolation requirements are handled by this method. 3.
2. The 20s parameter in Interval means that the inner query will generate results in a 20-second window. In a real query, it needs to be adjusted to the time interval between different records. This ensures that the interpolation results are generated equivalently to the original data.
Select apercentile(col1, 50, “t-digest”) from table_name
SELECT APERCENTILE(col1, 50, “t-digest”) FROM table_name
Remark.
...
...
@@ -254,7 +254,7 @@ Equivalent function: first
Example.
Select first(col1) from table_name
SELECT FIRST(col1) FROM table_name
**Last**
...
...
@@ -262,7 +262,7 @@ Equivalent function: last
Example.
Select last(col1) from table_name
SELECT LAST(col1) FROM table_name
**Max**
...
...
@@ -270,7 +270,7 @@ Equivalent function: max
Example.
Select max(value) from (select first(val) value from table_name interval(10s) fill(linear)) interval(10s)
SELECT MAX(value) FROM (SELECT FIRST(val) value FROM table_name INTERVAL(10s) FILL(linear)) INTERVAL(10s)
Note: The Max function requires interpolation, for the reasons given above.
...
...
@@ -280,13 +280,13 @@ Equivalent function: min
Example.
Select min(value) from (select first(val) value from table_name interval(10s) fill(linear)) interval(10s);
SELECT MIN(value) FROM (select first(val) value FROM table_name INTERVAL(10s) FILL(linear)) INTERVAL(10s);
**MinMax**
Equivalent function: max
Select max(val) from table_name
SELECT max(val) FROM table_name
Note: This function does not require interpolation, so it can be calculated directly.
...
...
@@ -294,7 +294,7 @@ Note: This function does not require interpolation, so it can be calculated dire
Equivalent function: min
Select min(val) from table_name
SELECT min(val) FROM table_name
Note: This function does not require interpolation, so it can be calculated directly.
...
...
@@ -308,7 +308,7 @@ Note:
Equivalent function: sum
Select max(value) from (select first(val) value from table_name interval(10s) fill(linear)) interval(10s)
SELECT MAX(value) FROM (SELECT FIRST(val) value FROM table_name INTERVAL(10s) FILL(linear)) INTERVAL(10s)
Note: This function does not require interpolation, so it can be calculated directly.
...
...
@@ -316,7 +316,7 @@ Note: This function does not require interpolation, so it can be calculated dire
Equivalent function: sum
Select sum(val) from table_name
SELECT SUM(val) FROM table_name
Note: This function does not require interpolation, so it can be calculated directly.
...
...
@@ -356,7 +356,7 @@ Combining the above formula and bringing the parameters into the calculation for
### Storage device selection considerations
The hard disk should be used with a better random read performance hard disk device, if you can have SSD, consider using SSD as much as possible. better random read performance of the disk is extremely helpful to improve the system query performance and can improve the overall query response performance of the system. To obtain better query performance, the performance index of single-threaded random read IOPS of the hard disk device should not be lower than 1000, it is better to reach 5000 IOPS or more. To obtain an evaluation of the current device random read IO performance, it is recommended that fio software be used to evaluate its operational performance (see Appendix 1 for details on how to use it) to confirm whether it can meet the large file random read performance requirements.
The hard disk should be used with a better random read performance hard disk device, if you can have SSD, consider using SSD as much as possible. better random read performance of the disk is extremely helpful to improve the system query performance and can improve the overall query response performance of the system. To obtain better query performance, the performance index of single-threaded random read IOPS of the hard disk device should not be lower than 1000, it is better to reach 5000 IOPS or more. To obtain an evaluation of the current device random read IO performance, it is recommended that `fio` software be used to evaluate its operational performance (see Appendix 1 for details on how to use it) to confirm whether it can meet the large file random read performance requirements.
Hard disk write performance has little impact on TDengine; TDengine writes in append write mode, so as long as it has good sequential write performance, both SAS hard disks and SSDs, in general, can meet TDengine's requirements for disk write performance well.
...
...
@@ -390,7 +390,7 @@ FQDN, firstEp, secondEP, dataDir, logDir, tmpDir, serverPort. The specific meani
Follow the same steps to set the parameters on the node that needs to run and start the taosd service, then add the Dnode to the cluster.
Finally, start taos and execute the command show dnodes, if you can see all the nodes that have joined the cluster, then the cluster is successfully built. For the specific operation procedure and notes, please refer to the document [TDengine Cluster Installation, Management](https://www.taosdata.com/cn/documentation/cluster).
Finally, start taos and execute the command `SHOW DNODES`, if you can see all the nodes that have joined the cluster, then the cluster is successfully built. For the specific operation procedure and notes, please refer to the document [TDengine Cluster Installation, Management](https://www.taosdata.com/cn/documentation/cluster).