数据仓库服务 GAUSSDB(DWS)-PARTITION:RANGE_N with different partition INTERVAL

时间:2024-10-26 11:41:18

RANGE_N with different partition INTERVAL

输入

CREATE MULTISET TABLE tab1
     ( TICD                  VARCHAR(10)
     , TCIT                   VARCHAR(10)
     , TCCM                  VARCHAR(50)
     , DW_Stat_Dt         DATE
    )
PRIMARY INDEX ( TICD )
PARTITION BY RANGE_N 
  ( DW_Stat_Dt BETWEEN DATE '0001-01-01' AND DATE '0001-01-04' EACH INTERVAL '1' DAY,
     DATE '0001-01-05' AND DATE '1899-12-31',
     DATE '1900-01-01' AND DATE '1900-01-01',
     DATE '1900-01-02' AND DATE '1999-12-31',
     DATE '2000-01-01' AND DATE '2009-12-31' EACH INTERVAL '1' YEAR,
     DATE '2010-01-01' AND DATE '2021-12-31' EACH INTERVAL '1' DAY,
     DATE '9999-12-31' AND DATE '9999-12-31', 
     NO RANGE );

输出

CREATE TABLE tab1 
     ( TICD                  VARCHAR( 10 )
     , TCIT                   VARCHAR( 10 )
     , TCCM                  VARCHAR( 50 )
     , DW_Stat_Dt         DATE
     ) 
DISTRIBUTE BY HASH (TICD) 
PARTITION BY RANGE (DW_Stat_Dt)
  ( PARTITION tab1_0 START (DATE '0001-01-01') END (DATE '0001-01-04') EVERY (INTERVAL '1' DAY),
     PARTITION tab1_1 START (DATE '0001-01-04') END (DATE '1899-12-31'),
     PARTITION tab1_2 START (DATE '1899-12-31') END (DATE '1900-01-01'),
     PARTITION tab1_ 3 START (DATE '1900-01-01') END (DATE '1999-12-31'),
     PARTITION tab1_4 START (DATE '1999-12-31') END (DATE '2009-12-31') EVERY (INTERVAL '1' YEAR) ,
     PARTITION tab1_5 START (DATE '2009-12-31') END (DATE '2021-12-31') EVERY (INTERVAL '1' DAY) ,
     PARTITION tab1_6 START (DATE '2021-12-31') END (DATE '9999-12-31') 
  );
support.huaweicloud.com/tg-dws/dws_16_0072.html