他的回复:
GaussDB(DWS)目前不支持离散型的分区划分策略,即所有分区的边界必须是依次首位链接的,对于楼主的需求,可以直接按天划分区间,然后允许一些分区里面没有数据,例如:postgres=# create table t1 (id int, t_time timestamp) partition by range(t_time) (partition "2021" start('2021-04-29') end('2021-05-10') every('1 day')); NOTICE: The 'DISTRIBUTE BY' clause is not specified. Using 'id' as the distribution column by default. HINT: Please use 'DISTRIBUTE BY' clause to specify suitable data distribution column. CREATE TABLE postgres=# select p.relname, p.parttype, p.parentid, p.reltuples, p.boundaries from pg_partition p, pg_class c where c.oid = p.parentid and c.relname = 't1'; relname | parttype | parentid | reltuples | boundaries ---------+----------+----------+-----------+------------------------- t1 | r | 44843 | 0 | 2021_0 | p | 44843 | 0 | {"2021-04-29 00:00:00"} 2021_1 | p | 44843 | 0 | {"2021-04-30 00:00:00"} 2021_2 | p | 44843 | 0 | {"2021-05-01 00:00:00"} 2021_3 | p | 44843 | 0 | {"2021-05-02 00:00:00"} 2021_4 | p | 44843 | 0 | {"2021-05-03 00:00:00"} 2021_5 | p | 44843 | 0 | {"2021-05-04 00:00:00"} 2021_6 | p | 44843 | 0 | {"2021-05-05 00:00:00"} 2021_7 | p | 44843 | 0 | {"2021-05-06 00:00:00"} 2021_8 | p | 44843 | 0 | {"2021-05-07 00:00:00"} 2021_9 | p | 44843 | 0 | {"2021-05-08 00:00:00"} 2021_10 | p | 44843 | 0 | {"2021-05-09 00:00:00"} 2021_11 | p | 44843 | 0 | {"2021-05-10 00:00:00"} (13 rows)