数据仓库服务 GAUSSDB(DWS)-索引:创建带索引分区表

时间:2024-12-10 11:28:48

创建带索引分区表

如果配置参数tdMigrateRANGE_Ntrue。

输入

CREATE SET TABLE SC.TAB , NO FALLBACK,
NO BEFORE JOURNAL,
NO AFTER JOURNAL,
CHECKSUM=DEFAULT,
DEFAULT MERGEBLOCKRATIO
(
ACCOUNT_NUM VARCHAR(255) CHARACTER SET LATIN NOT CASESPECIFIC NOT NULL
,ACCOUNT_MODIFIER_NUM CHAR(18) CHARACTER SET LATIN NOT CASESPECIFIC NOT NULL
,END_DT DATE FORMAT 'YYYY-MM-DD'
,UPD_TXF_BATCHTD INTEGER COMPRESS
)
PRIMARY INDEX XPKT0300_AGREEMENT (ACCOUNT_NUM,ACCOUNT_MODIFIER_NUM)
PARTITION BY RANGE_N(END_DT BETWEEN '2001-01-01' AND '2020-12-31' EACH INTERVAL '1' DAY, NO RANGE ,UNKNOWN)
INDEX (UPD_TXF_BATCHTD)
;

输出

CREATE
     TABLE
          SC.TAB (
               ACCOUNT_NUM VARCHAR( 255 ) /* CHARACTER SET LATIN*/
                /* NOT CASESPECIFIC*/               NOT NULL
               ,ACCOUNT_MODIFIER_NUM CHAR( 18 ) /* CHARACTER SET LATIN*/               /* NOT CASESPECIFIC*/               NOT NULL
               ,END_DT DATE
               ,UPD_TXF_BATCHTD INTEGER /* COMPRESS */
          ) DISTRIBUTE BY HASH (
               ACCOUNT_NUM
               ,ACCOUNT_MODIFIER_NUM
          ) PARTITION BY RANGE (END_DT) (
               PARTITION TAB_1 start ('2001-01-01')
          END ('2020-12-31') EVERY (
               INTERVAL '1' DAY )
          ) ;
CREATE INDEX ON SC.TAB (UPD_TXF_BATCHTD) LOCAL;
support.huaweicloud.com/tg-dws/dws_16_0069.html