@@ -10,7 +10,7 @@ TDengine does not save tags as a part of the data points collected. Instead, tag
Like a table, you can create, show, delete and describe STables. Most query operations on tables can be applied to STable too, including the aggregation and selector functions. For queries on a STable, if no tags filter, the operations are applied to all the tables created via this STable. If there is a tag filter, the operations are applied only to a subset of the tables which satisfy the tag filter conditions. It will be very convenient to use tags to put devices into different groups for aggregation.
##Create a STable
##Create a STable
Similiar to creating a standard table, syntax is:
...
...
@@ -37,7 +37,7 @@ tags (location binary(20), type int)
The above statement creates a STable thermometer with two tag "location" and "type"
##Create a Table via STable
##Create a Table via STable
To create a table for a device, you can use a STable as its template and assign the tag values. The syntax is:
...
...
@@ -162,7 +162,7 @@ The above SQL statement will list the number of tables in a STable, which satisf
You can add, delete and change the tags for a STable, and you can change the tag value of a table. The SQL commands are listed below.
###Add a Tag
###Add a Tag
```mysql
ALTER TABLE <stable_name> ADD TAG <new_tag_name> <TYPE>
...
...
@@ -170,7 +170,7 @@ ALTER TABLE <stable_name> ADD TAG <new_tag_name> <TYPE>
It adds a new tag to the STable with a data type. The maximum number of tags is 6.
###Drop a Tag
###Drop a Tag
```mysql
ALTER TABLE <stable_name> DROP TAG <tag_name>
...
...
@@ -178,7 +178,7 @@ ALTER TABLE <stable_name> DROP TAG <tag_name>
It drops a tag from a STable. The first tag could not be deleted, and there must be at least one tag.
###Change a Tag's Name
###Change a Tag's Name
```mysql
ALTER TABLE <stable_name> CHANGE TAG <old_tag_name> <new_tag_name>
...
...
@@ -186,7 +186,7 @@ ALTER TABLE <stable_name> CHANGE TAG <old_tag_name> <new_tag_name>
It changes the name of a tag from old to new.
###Change the Tag's Value
###Change the Tag's Value
```mysql
ALTER TABLE <table_name> SET TAG <tag_name>=<new_tag_value>
TDengine provides a SQL like query language to insert or query data. You can execute the SQL statements through the TDengine Shell, or through C/C++, Java(JDBC), Python, Restful, Go, and Node.js APIs to interact with the `taosd` service.
...
...
@@ -9,9 +9,9 @@ Before reading through, please have a look at the conventions used for syntax de
* A single verticle line ("|") works a separator for multiple optional args or clauses
* Dots ("…") means repeating for as many times
##Data Types
##Data Types
###Timestamp
###Timestamp
The timestamp is the most important data type in TDengine. The first column of each table must be **`TIMESTAMP`** type, but other columns can also be **`TIMESTAMP`** type. The following rules for timestamp:
...
...
@@ -25,7 +25,7 @@ The timestamp is the most important data type in TDengine. The first column of e
Default time precision is millisecond, you can change it to microseocnd by setting parameter enableMicrosecond in [system configuration](../administrator/#Configuration-on-Server). For epoch time, the long integer shall be microseconds since the epoch. For the above string format, MS shall be six digits.
###Data Types
###Data Types
The full list of data types is listed below. For string types of data, we will use ***M*** to indicate the maximum length of that type.
...
...
@@ -44,7 +44,7 @@ The full list of data types is listed below. For string types of data, we will
All the keywords in a SQL statement are case-insensitive, but strings values are case-sensitive and must be quoted by a pair of `'` or `"`. To quote a `'` or a `"` , you can use the escape character `\`.
Continuous Query is a query executed by TDengine periodically with a sliding window, it is a simplified stream computing driven by timers, not by events. Continuous query can be applied to a table or a STable, and the result set can be passed to the application directly via call back function, or written into a new table in TDengine. The query is always executed on a specified time window (window size is specified by parameter interval), and this window slides forward while time flows (the sliding period is specified by parameter sliding).
Continuous query is defined by TAOS SQL, there is nothing special. One of the best applications is downsampling. Once it is defined, at the end of each cycle, the system will execute the query, pass the result to the application or write it to a database.
If historical data pints are inserted into the stream, the query won't be re-executed, and the result set won't be updated. If the result set is passed to the application, the application needs to keep the status of continuous query, the server won't maintain it. If application re-starts, it needs to decide the time where the stream computing shall be started.
####How to use continuous query
####How to use continuous query
...
...
@@ -73,8 +73,8 @@ By this design, the application can retrieve the latest data from each device su
select last(*) from thermometers where location=’beijing’
```
By this design, caching tool, like Redis, is not needed in the system. It will reduce the complexity of the system.
Through this design, caching tools like Redis are no longer needed in the system, helping reduce the complexity of the system.
TDengine creates one or more virtual nodes(vnode) in each data node. Each vnode contains data for multiple tables and has its own buffer. The buffer of a vnode is fully separated from the buffer of another vnode, not shared. But the tables in a vnode share the same buffer.
System configuration parameter cacheBlockSize configures the cache block size in bytes, and another parameter cacheNumOfBlocks configures the number of cache blocks. The total memory for the buffer of a vnode is $cacheBlockSize \times cacheNumOfBlocks$. Another system parameter numOfBlocksPerMeter configures the maximum number of cache blocks a table can use. When you create a database, you can specify these parameters.
\ No newline at end of file
System configuration parameter cacheBlockSize configures the cache block size in bytes, and another parameter cacheNumOfBlocks configures the number of cache blocks. The total memory for the buffer of a vnode is `cacheBlockSize * cacheNumOfBlocks`. Another system parameter `numOfBlocksPerMeter` configures the maximum number of cache blocks a table can use. When you create a database, you can specify these parameters.