docs: add more info for 'alter table'

This commit is contained in:
Shungang Li 2024-06-18 17:48:26 +08:00
parent 4bbd858335
commit 7cccaa12d8
2 changed files with 24 additions and 4 deletions

View File

@ -52,9 +52,9 @@ table_option: {
**Parameter description** **Parameter description**
1. COMMENT: specifies comments for the table. This parameter can be used with supertables, standard tables, and subtables. 1. COMMENT: specifies comments for the table. This parameter can be used with supertables, standard tables, and subtables. The maximum length of the comment is 1024 bytes.
2. SMA: specifies functions on which to enable small materialized aggregates (SMA). SMA is user-defined precomputation of aggregates based on data blocks. Enter one of the following values: max, min, or sum This parameter can be used with supertables and standard tables. 2. SMA: specifies functions on which to enable small materialized aggregates (SMA). SMA is user-defined precomputation of aggregates based on data blocks. Enter one of the following values: max, min, or sum This parameter can be used with supertables and standard tables.
3. TTL: specifies the time to live (TTL) for the table. If TTL is specified when creatinga table, after the time period for which the table has been existing is over TTL, TDengine will automatically delete the table. Please be noted that the system may not delete the table at the exact moment that the TTL expires but guarantee there is such a system and finally the table will be deleted. The unit of TTL is in days. The default value is 0, i.e. never expire. 3. TTL: specifies the time to live (TTL) for the table. If TTL is specified when creatinga table, after the time period for which the table has been existing is over TTL, TDengine will automatically delete the table. Please be noted that the system may not delete the table at the exact moment that the TTL expires but guarantee there is such a system and finally the table will be deleted. The unit of TTL is in days. The value range is [0, 2147483647]. The default value is 0, i.e. never expire.
## Create Subtables ## Create Subtables
@ -112,6 +112,11 @@ You can perform the following modifications on existing tables:
4. RENAME COLUMN: renames a specified column in the table. 4. RENAME COLUMN: renames a specified column in the table.
5. The primary key column of a table cannot be modified or added or deleted using ADD/DROP COLUMN. 5. The primary key column of a table cannot be modified or added or deleted using ADD/DROP COLUMN.
**Parameter description**
1. COMMENT: specifies comments for the table. This parameter can be used with supertables, standard tables, and subtables. The maximum length of the comment is 1024 bytes.
2. TTL: specifies the time to live (TTL) for the table. If TTL is specified when creatinga table, after the time period for which the table has been existing is over TTL, TDengine will automatically delete the table. Please be noted that the system may not delete the table at the exact moment that the TTL expires but guarantee there is such a system and finally the table will be deleted. The unit of TTL is in days. The value range is [0, 2147483647]. The default value is 0, i.e. never expire.
### Add a Column ### Add a Column
```sql ```sql
@ -171,6 +176,11 @@ alter_table_option: {
1. Only the value of a tag can be modified directly. For all other modifications, you must modify the supertable from which the subtable was created. 1. Only the value of a tag can be modified directly. For all other modifications, you must modify the supertable from which the subtable was created.
**Parameter description**
1. COMMENT: specifies comments for the table. This parameter can be used with supertables, standard tables, and subtables. The maximum length of the comment is 1024 bytes.
2. TTL: specifies the time to live (TTL) for the table. If TTL is specified when creatinga table, after the time period for which the table has been existing is over TTL, TDengine will automatically delete the table. Please be noted that the system may not delete the table at the exact moment that the TTL expires but guarantee there is such a system and finally the table will be deleted. The unit of TTL is in days. The value range is [0, 2147483647]. The default value is 0, i.e. never expire.
### Change Tag Value Of Sub Table ### Change Tag Value Of Sub Table
``` ```

View File

@ -52,9 +52,9 @@ table_option: {
**参数说明** **参数说明**
1. COMMENT表注释。可用于超级表、子表和普通表。 1. COMMENT表注释。可用于超级表、子表和普通表。最大长度为 1024 个字节。
2. SMASmall Materialized Aggregates提供基于数据块的自定义预计算功能。预计算类型包括 MAX、MIN 和 SUM。可用于超级表/普通表。 2. SMASmall Materialized Aggregates提供基于数据块的自定义预计算功能。预计算类型包括 MAX、MIN 和 SUM。可用于超级表/普通表。
3. TTLTime to Live是用户用来指定表的生命周期的参数。如果创建表时指定了这个参数当该表的存在时间超过 TTL 指定的时间后TDengine 自动删除该表。这个 TTL 的时间只是一个大概时间系统不保证到了时间一定会将其删除而只保证存在这样一个机制且最终一定会删除。TTL 单位是天,默认为 0表示不限制到期时间为表创建时间加上 TTL 时间。TTL 与数据库 KEEP 参数没有关联,如果 KEEP 比 TTL 小,在表被删除之前数据也可能已经被删除。 3. TTLTime to Live是用户用来指定表的生命周期的参数。如果创建表时指定了这个参数当该表的存在时间超过 TTL 指定的时间后TDengine 自动删除该表。这个 TTL 的时间只是一个大概时间系统不保证到了时间一定会将其删除而只保证存在这样一个机制且最终一定会删除。TTL 单位是天,取值范围为[0, 2147483647]默认为 0表示不限制到期时间为表创建时间加上 TTL 时间。TTL 与数据库 KEEP 参数没有关联,如果 KEEP 比 TTL 小,在表被删除之前数据也可能已经被删除。
## 创建子表 ## 创建子表
@ -112,6 +112,11 @@ alter_table_option: {
4. RENAME COLUMN修改列名称。 4. RENAME COLUMN修改列名称。
5. 普通表的主键列不能被修改,也不能通过 ADD/DROP COLUMN 来添加/删除主键列。 5. 普通表的主键列不能被修改,也不能通过 ADD/DROP COLUMN 来添加/删除主键列。
**参数说明**
1. COMMENT表注释。可用于超级表、子表和普通表。最大长度为 1024 个字节。
2. TTLTime to Live是用户用来指定表的生命周期的参数。如果创建表时指定了这个参数当该表的存在时间超过 TTL 指定的时间后TDengine 自动删除该表。这个 TTL 的时间只是一个大概时间系统不保证到了时间一定会将其删除而只保证存在这样一个机制且最终一定会删除。TTL 单位是天,取值范围为[0, 2147483647],默认为 0表示不限制到期时间为表创建时间加上 TTL 时间。TTL 与数据库 KEEP 参数没有关联,如果 KEEP 比 TTL 小,在表被删除之前数据也可能已经被删除。
### 增加列 ### 增加列
```sql ```sql
@ -171,6 +176,11 @@ alter_table_option: {
1. 对子表的列和标签的修改,除了更改标签值以外,都要通过超级表才能进行。 1. 对子表的列和标签的修改,除了更改标签值以外,都要通过超级表才能进行。
**参数说明**
1. COMMENT表注释。可用于超级表、子表和普通表。最大长度为 1024 个字节。
2. TTLTime to Live是用户用来指定表的生命周期的参数。如果创建表时指定了这个参数当该表的存在时间超过 TTL 指定的时间后TDengine 自动删除该表。这个 TTL 的时间只是一个大概时间系统不保证到了时间一定会将其删除而只保证存在这样一个机制且最终一定会删除。TTL 单位是天,取值范围为[0, 2147483647],默认为 0表示不限制到期时间为表创建时间加上 TTL 时间。TTL 与数据库 KEEP 参数没有关联,如果 KEEP 比 TTL 小,在表被删除之前数据也可能已经被删除。
### 修改子表标签值 ### 修改子表标签值
``` ```