You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/UserGuide/Master/Table/Basic-Concept/Table-Management_apache.md
+45-11Lines changed: 45 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,15 +21,49 @@
21
21
22
22
# Table Management
23
23
24
-
Before starting to use the table management functionality, we recommend familiarizing yourself with the following related background knowledge for a better understanding and application of the table management features:
25
-
*[Timeseries Data Model](../Background-knowledge/Navigating_Time_Series_Data_apache.md): Understand the basic concepts and characteristics of time series data to establish a foundation for data modeling.
26
-
*[Modeling Scheme Design](../Background-knowledge/Data-Model-and-Terminology_apache.md): Master the IoTDB time series model and its applicable scenarios to provide a design basis for table management.
24
+
In the table model, it is recommended that one table corresponds to one type of device, for managing time series data of such devices. Devices of the same type usually have the same or similar set of measurement points, such as wind turbines, vehicles, production equipment or monitoring objects of the same category.
27
25
28
-
## 1. Table Management
26
+
## 1. Basic Concepts
29
27
30
-
### 1.1 Create a Table
28
+
### 1.1 Table
31
29
32
-
#### 1.1.1 Manually create a table with CREATE
30
+
Tables are generally used to store time series data for the same type of device. During data modeling, device identification information can be designed as TAG columns, static device descriptions as ATTRIBUTE columns, and time-varying collected values as FIELD columns.
31
+
32
+
### 1.2 Time Column, Tag Column, Attribute Column and Measurement Column
33
+
34
+

35
+
36
+
The table structure in the table model is generally shown in the figure above. Columns can be classified into the following categories by purpose:
37
+
38
+
| Concept | Description |
39
+
| ------- | ----------- |
40
+
| Time Column (TIME) | Each table must contain one time column of the TIMESTAMP data type, which records the timestamp corresponding to each data point. |
41
+
| Tag Column (TAG) | Used to identify devices and can serve as the composite primary key of a device. It typically stores information for locating devices, such as region, plant, and device ID. Values in tag columns usually do not change over time. |
42
+
| Attribute Column (ATTRIBUTE) | Used to describe static attributes of a device, such as model, manufacturer, and maintenance information. Attribute columns do not change over time and can be added or updated. |
43
+
| Measurement Column (FIELD) | Used to store physical quantities or metrics collected from devices, whose values change over time, such as temperature, humidity, current, voltage, and status. |
44
+
45
+
In terms of query filtering efficiency, the general priority order is: time column and tag columns first, followed by attribute columns, and measurement columns last.
46
+
47
+
### 1.3 Devices and Measurement Points
48
+
49
+
In the table model, a device is uniquely identified by the combination of values from all TAG columns in a table. For example, if a table contains three TAG columns: `region`, `plant_id`, and `device_id`, each unique combination of `region + plant_id + device_id` represents an independent device.
50
+
51
+
Measurement points correspond to FIELD columns in the table. One FIELD column for a single device generates multiple data points over time, and these time-ordered data points form a time series.
52
+
53
+
Therefore, the number of measurement points per table in the table model can be expressed by the following formula:
54
+
`Number of measurement points per table = Number of devices × Number of FIELD columns`
55
+
56
+
### 1.4 Table-Level TTL
57
+
58
+
The TTL of a table defaults to the TTL of its parent database. If a table is configured with a separate TTL, the table-level TTL takes precedence. Proper use of table-level TTL allows different data retention periods to be set for different business tables.
59
+
60
+
For a more detailed introduction to TTL features, see: [TTL Delete Data](../Basic-Concept/TTL-Delete-Data_apache.md)
61
+
62
+
For further information on the IoTDB tree-table twin model, model selection methods and typical modeling solutions, please refer to [Modeling Scheme Design](../Background-knowledge/Data-Model-and-Terminology_apache.md).
63
+
64
+
## 2. Table Management
65
+
66
+
### 2.1 Create a Table
33
67
34
68
Manually create a table within the current or specified database.The format is "database name. table name".
35
69
@@ -111,7 +145,7 @@ CREATE TABLE table1 (
111
145
112
146
Note: If your terminal does not support multi-line paste (e.g., Windows CMD), please reformat the SQL statement into a single line before execution.
113
147
114
-
### 1.2 View Tables
148
+
### 2.2 View Tables
115
149
116
150
Used to view all tables and their properties in the current or a specified database.
117
151
@@ -143,7 +177,7 @@ show tables details from database1;
143
177
+---------------+-----------+------+-------+
144
178
```
145
179
146
-
### 1.3 View Table Columns
180
+
### 2.3 View Table Columns
147
181
148
182
Used to view column names, data types, categories, and states of a table.
149
183
@@ -183,7 +217,7 @@ desc table1 details;
183
217
```
184
218
185
219
186
-
### 1.4 View Table Creation Statement
220
+
### 2.4 View Table Creation Statement
187
221
188
222
Retrieves the complete definition statement of a table or view under the table model. This feature automatically fills in all default values that were omitted during creation, so the displayed statement may differ from the original CREATE statement.
189
223
@@ -213,7 +247,7 @@ show create table table1;
213
247
```
214
248
215
249
216
-
### 1.5 Update Tables
250
+
### 2.5 Update Tables
217
251
218
252
Used to update a table, including adding or deleting columns and configuring table properties.
219
253
@@ -254,7 +288,7 @@ COMMENT ON TABLE table1 IS 'table1';
Copy file name to clipboardExpand all lines: src/UserGuide/Master/Table/Basic-Concept/Table-Management_timecho.md
+49-13Lines changed: 49 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,16 +20,51 @@
20
20
-->
21
21
22
22
# Table Management
23
+
24
+
In the table model, it is recommended that one table corresponds to one type of device, for managing time series data of such devices. Devices of the same type usually have the same or similar set of measurement points, such as wind turbines, vehicles, production equipment or monitoring objects of the same category.
23
25
24
-
Before starting to use the table management functionality, we recommend familiarizing yourself with the following related background knowledge for a better understanding and application of the table management features:
25
-
*[Timeseries Data Model](../Background-knowledge/Navigating_Time_Series_Data_timecho.md): Understand the basic concepts and characteristics of time series data to establish a foundation for data modeling.
26
-
*[Modeling Scheme Design](../Background-knowledge/Data-Model-and-Terminology_timecho.md): Master the IoTDB time series model and its applicable scenarios to provide a design basis for table management.
26
+
## 1. Basic Concepts
27
27
28
-
## 1. Table Management
28
+
###1.1 Table
29
29
30
-
### 1.1 Create a Table
30
+
Tables are generally used to store time series data for the same type of device. During data modeling, device identification information can be designed as TAG columns, static device descriptions as ATTRIBUTE columns, and time-varying collected values as FIELD columns.
31
31
32
-
#### 1.1.1 Manually create a table with CREATE
32
+
### 1.2 Time Column, Tag Column, Attribute Column and Measurement Column
33
+
34
+

35
+
36
+
The table structure in the table model is generally shown in the figure above. Columns can be classified into the following categories by purpose:
37
+
38
+
| Concept | Description |
39
+
| ------- | ----------- |
40
+
| Time Column (TIME) | Each table must contain one time column of the TIMESTAMP data type, which records the timestamp corresponding to each data point. |
41
+
| Tag Column (TAG) | Used to identify devices and can serve as the composite primary key of a device. It typically stores information for locating devices, such as region, plant, and device ID. Values in tag columns usually do not change over time. |
42
+
| Attribute Column (ATTRIBUTE) | Used to describe static attributes of a device, such as model, manufacturer, and maintenance information. Attribute columns do not change over time and can be added or updated. |
43
+
| Measurement Column (FIELD) | Used to store physical quantities or metrics collected from devices, whose values change over time, such as temperature, humidity, current, voltage, and status. |
44
+
45
+
In terms of query filtering efficiency, the general priority order is: time column and tag columns first, followed by attribute columns, and measurement columns last.
46
+
47
+
### 1.3 Devices and Measurement Points
48
+
49
+
In the table model, a device is uniquely identified by the combination of values from all TAG columns in a table. For example, if a table contains three TAG columns: `region`, `plant_id`, and `device_id`, each unique combination of `region + plant_id + device_id` represents an independent device.
50
+
51
+
Measurement points correspond to FIELD columns in the table. One FIELD column for a single device generates multiple data points over time, and these time-ordered data points form a time series.
52
+
53
+
Therefore, the number of measurement points per table in the table model can be expressed by the following formula:
54
+
`Number of measurement points per table = Number of devices × Number of FIELD columns`
55
+
For the specific calculation process, please refer to Section 2.7 *Metadata Query*.
56
+
57
+
### 1.4 Table-Level TTL
58
+
59
+
The TTL of a table defaults to the TTL of its parent database. If a table is configured with a separate TTL, the table-level TTL takes precedence. Proper use of table-level TTL allows different data retention periods to be set for different business tables.
60
+
61
+
For a more detailed introduction to TTL features, see: [TTL Delete Data](../Basic-Concept/TTL-Delete-Data_timecho.md)
62
+
63
+
For further information on the IoTDB tree-table twin model, model selection methods and typical modeling solutions, please refer to [Modeling Scheme Design](../Background-knowledge/Data-Model-and-Terminology_timecho.md).
64
+
65
+
## 2. Table Management
66
+
67
+
### 2.1 Create a Table
33
68
34
69
Manually create a table within the current or specified database.The format is "database name. table name".
35
70
@@ -111,7 +146,7 @@ CREATE TABLE table1 (
111
146
112
147
Note: If your terminal does not support multi-line paste (e.g., Windows CMD), please reformat the SQL statement into a single line before execution.
113
148
114
-
### 1.2 View Tables
149
+
### 2.2 View Tables
115
150
116
151
Used to view all tables and their properties in the current or a specified database.
117
152
@@ -143,7 +178,7 @@ show tables details from database1;
143
178
+---------------+-----------+------+-------+
144
179
```
145
180
146
-
### 1.3 View Table Columns
181
+
### 2.3 View Table Columns
147
182
148
183
Used to view column names, data types, categories, and states of a table.
Retrieves the complete definition statement of a table or view under the table model. This feature automatically fills in all default values that were omitted during creation, so the displayed statement may differ from the original CREATE statement.
188
223
@@ -213,7 +248,7 @@ Total line number = 1
213
248
```
214
249
215
250
216
-
### 1.5 Update Tables
251
+
### 2.5 Update Tables
217
252
218
253
Used to update a table, including adding or deleting columns, modify column type (V2.0.8.2) and configuring table properties.
219
254
@@ -264,7 +299,7 @@ alter column datatype
264
299
ALTER TABLE table1 ALTER COLUMN IF EXISTS b SET DATA TYPE DOUBLE;
265
300
```
266
301
267
-
### 1.6 Delete Tables
302
+
### 2.6 Delete Tables
268
303
269
304
Used to delete a table.
270
305
@@ -281,7 +316,7 @@ DROP TABLE table1;
281
316
DROP TABLE database1.table1;
282
317
```
283
318
284
-
## 1.7 Metadata Query
319
+
### 2.7 Metadata Query
285
320
Under the table model, the **total number of measurement points** equals the sum of measurement points of all tables. Currently, the number of measurement points in a single table can be calculated with the formula:
286
321
**Measurement points per single table =Number of devices × Number of field columns**.
287
322
Support for directly querying measurement points under the table model via SQL statements will be available in future updates. Please stay tuned.
@@ -301,7 +336,8 @@ The sample data defines 2 regions: Beijing and Shanghai. Details are as follows:
301
336
302
337
In total, there are 6 unique tag combinations in the table, corresponding to 6 independent devices.
303
338
304
-
### Complete Calculation Example for Single-Table Measurement Points
339
+
**Complete Calculation Example for Single-Table Measurement Points**
Copy file name to clipboardExpand all lines: src/UserGuide/latest-Table/Basic-Concept/Table-Management_apache.md
+45-11Lines changed: 45 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,15 +21,49 @@
21
21
22
22
# Table Management
23
23
24
-
Before starting to use the table management functionality, we recommend familiarizing yourself with the following related background knowledge for a better understanding and application of the table management features:
25
-
*[Timeseries Data Model](../Background-knowledge/Navigating_Time_Series_Data_apache.md): Understand the basic concepts and characteristics of time series data to establish a foundation for data modeling.
26
-
*[Modeling Scheme Design](../Background-knowledge/Data-Model-and-Terminology_apache.md): Master the IoTDB time series model and its applicable scenarios to provide a design basis for table management.
24
+
In the table model, it is recommended that one table corresponds to one type of device, for managing time series data of such devices. Devices of the same type usually have the same or similar set of measurement points, such as wind turbines, vehicles, production equipment or monitoring objects of the same category.
27
25
28
-
## 1. Table Management
26
+
## 1. Basic Concepts
29
27
30
-
### 1.1 Create a Table
28
+
### 1.1 Table
31
29
32
-
#### 1.1.1 Manually create a table with CREATE
30
+
Tables are generally used to store time series data for the same type of device. During data modeling, device identification information can be designed as TAG columns, static device descriptions as ATTRIBUTE columns, and time-varying collected values as FIELD columns.
31
+
32
+
### 1.2 Time Column, Tag Column, Attribute Column and Measurement Column
33
+
34
+

35
+
36
+
The table structure in the table model is generally shown in the figure above. Columns can be classified into the following categories by purpose:
37
+
38
+
| Concept | Description |
39
+
| ------- | ----------- |
40
+
| Time Column (TIME) | Each table must contain one time column of the TIMESTAMP data type, which records the timestamp corresponding to each data point. |
41
+
| Tag Column (TAG) | Used to identify devices and can serve as the composite primary key of a device. It typically stores information for locating devices, such as region, plant, and device ID. Values in tag columns usually do not change over time. |
42
+
| Attribute Column (ATTRIBUTE) | Used to describe static attributes of a device, such as model, manufacturer, and maintenance information. Attribute columns do not change over time and can be added or updated. |
43
+
| Measurement Column (FIELD) | Used to store physical quantities or metrics collected from devices, whose values change over time, such as temperature, humidity, current, voltage, and status. |
44
+
45
+
In terms of query filtering efficiency, the general priority order is: time column and tag columns first, followed by attribute columns, and measurement columns last.
46
+
47
+
### 1.3 Devices and Measurement Points
48
+
49
+
In the table model, a device is uniquely identified by the combination of values from all TAG columns in a table. For example, if a table contains three TAG columns: `region`, `plant_id`, and `device_id`, each unique combination of `region + plant_id + device_id` represents an independent device.
50
+
51
+
Measurement points correspond to FIELD columns in the table. One FIELD column for a single device generates multiple data points over time, and these time-ordered data points form a time series.
52
+
53
+
Therefore, the number of measurement points per table in the table model can be expressed by the following formula:
54
+
`Number of measurement points per table = Number of devices × Number of FIELD columns`
55
+
56
+
### 1.4 Table-Level TTL
57
+
58
+
The TTL of a table defaults to the TTL of its parent database. If a table is configured with a separate TTL, the table-level TTL takes precedence. Proper use of table-level TTL allows different data retention periods to be set for different business tables.
59
+
60
+
For a more detailed introduction to TTL features, see: [TTL Delete Data](../Basic-Concept/TTL-Delete-Data_apache.md)
61
+
62
+
For further information on the IoTDB tree-table twin model, model selection methods and typical modeling solutions, please refer to [Modeling Scheme Design](../Background-knowledge/Data-Model-and-Terminology_apache.md).
63
+
64
+
## 2. Table Management
65
+
66
+
### 2.1 Create a Table
33
67
34
68
Manually create a table within the current or specified database.The format is "database name. table name".
35
69
@@ -111,7 +145,7 @@ CREATE TABLE table1 (
111
145
112
146
Note: If your terminal does not support multi-line paste (e.g., Windows CMD), please reformat the SQL statement into a single line before execution.
113
147
114
-
### 1.2 View Tables
148
+
### 2.2 View Tables
115
149
116
150
Used to view all tables and their properties in the current or a specified database.
117
151
@@ -143,7 +177,7 @@ show tables details from database1;
143
177
+---------------+-----------+------+-------+
144
178
```
145
179
146
-
### 1.3 View Table Columns
180
+
### 2.3 View Table Columns
147
181
148
182
Used to view column names, data types, categories, and states of a table.
149
183
@@ -183,7 +217,7 @@ desc table1 details;
183
217
```
184
218
185
219
186
-
### 1.4 View Table Creation Statement
220
+
### 2.4 View Table Creation Statement
187
221
188
222
Retrieves the complete definition statement of a table or view under the table model. This feature automatically fills in all default values that were omitted during creation, so the displayed statement may differ from the original CREATE statement.
189
223
@@ -213,7 +247,7 @@ show create table table1;
213
247
```
214
248
215
249
216
-
### 1.5 Update Tables
250
+
### 2.5 Update Tables
217
251
218
252
Used to update a table, including adding or deleting columns and configuring table properties.
219
253
@@ -254,7 +288,7 @@ COMMENT ON TABLE table1 IS 'table1';
0 commit comments