更新时间:2024-06-29 GMT+08:00
VOLATILE
输入文件中包含表的专用关键词VOLATILE,但GaussDB(DWS)不支持该关键词。因此,DSC在迁移过程中用关键词LOCAL TEMPORARY替换该关键词。根据配置输入,Volatile表在迁移中标记为本地临时表或无日志表。
输入:CREATE VOLATILE TABLE
1
|
CREATE VOLATILE TABLE T1 (c1 int ,c2 int); |
输出:
1 2 3 4 5 6 7 |
CREATE LOCAL TEMPORARY TABLE T1 ( c1 INTEGER ,c2 INTEGER ) ; |
输入:CREATE VOLATILE TABLE AS WITH DATA(session_mode=Teradata)
如果源表具有PRIMARY KEY(主键)或UNIQUE CONSTRAINT(唯一约束),则该表不包含任何重复记录。在这种情况下,不需要添加MINUS操作符删除重复的记录。
1 2 3 4 5 6 7 8 9 10 |
CREATE VOLATILE TABLE tabV1 ( C1 INTEGER DEFAULT 99 ,C2 INTEGER ,C3 INTEGER ,C4 NUMERIC (20,0) DEFAULT NULL (BIGINT) ,CONSTRAINT XX1 PRIMARY KEY ( C1, C2 ) ) PRIMARY INDEX (C1, C3 ); CREATE TABLE tabV2 AS tabV1 WITH DATA PRIMARY INDEX (C1) ON COMMIT PRESERVE ROWS; |
输出:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
CREATE LOCAL TEMPORARY TABLE tabV1 ( C1 INTEGER DEFAULT 99 ,C2 INTEGER ,C3 INTEGER ,C4 NUMERIC (20,0) DEFAULT CAST( NULL AS BIGINT ) ,CONSTRAINT XX1 PRIMARY KEY ( C1, C2 ) ) DISTRIBUTE BY HASH (C1); BEGIN CREATE TABLE tabV2 ( LIKE tabV1 INCLUDING ALL EXCLUDING PARTITION EXCLUDING RELOPTIONS EXCLUDING DISTRIBUTION ) DISTRIBUTE BY HASH (C1); INSERT INTO tabV2 SELECT * FROM tabV1; END ; / |
父主题: 表迁移