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
+46-12Lines changed: 46 additions & 12 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';
254
288
COMMENT ON COLUMN table1.a IS null;
255
289
```
256
290
257
-
### 1.6 Delete Tables
291
+
### 2.6 Delete Tables
258
292
259
293
Used to delete a table.
260
294
@@ -268,4 +302,4 @@ DROP TABLE (IF EXISTS)? <TABLE_NAME>
Copy file name to clipboardExpand all lines: src/UserGuide/latest-Table/Basic-Concept/Table-Management_apache.md
+46-12Lines changed: 46 additions & 12 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';
254
288
COMMENT ON COLUMN table1.a IS null;
255
289
```
256
290
257
-
### 1.6 Delete Tables
291
+
### 2.6 Delete Tables
258
292
259
293
Used to delete a table.
260
294
@@ -268,4 +302,4 @@ DROP TABLE (IF EXISTS)? <TABLE_NAME>
0 commit comments