数据仓库服务 GAUSSDB(DWS)-ALTER TABLE:示例

时间:2024-07-13 11:25:01

示例

创建简单的时序表:

1
2
3
4
5
6
7
CREATE TABLE CPU(
idle numeric TSField,
IO numeric TSField,
scope text TSTag,
IP text TSTag,
time timestamp TSTime
) with (TTL='7 days', PERIOD = '1 day', orientation=TIMESERIES);

时序表增加列:

1
ALTER TABLE CPU ADD COLUMN memory numeric TSField;

时序表删除列:

1
ALTER TABLE CPU DROP COLUMN idle;

时序表修改列名:

1
ALTER TABLE CPU RENAME scope to scope1; 

时序表修改TTL,设置分区存活的时间为7天:

1
ALTER TABLE CPU SET (TTL = '7 day');

时序表修改Period,设置分区创建的周期为1天:

1
ALTER TABLE CPU SET (PERIOD = '1 day');
时序表修改delta表相关参数:
1
ALTER TABLE CPU SET (enable_delta = false);
support.huaweicloud.com/IoT-devg830-dws/dws_14_00005.html