pg 多级分区表 list-range

create table  CH_SRV_FEEDBACK
(
  SURVEYID   VARCHAR(32) not null,
  ITEMID     VARCHAR(32) not null,
  OPERID     VARCHAR(32) not null,
  OPTIONID   VARCHAR(2) default '0' not null,
  REGION     int8 not null,
  ANSWER     VARCHAR(1024),
  CREATETIME DATE  not null
) partition by list (REGION);

create table PART_310 partition of CH_SRV_FEEDBACK  for values in (310) partition by range (CREATETIME);
create table PART_311 partition of CH_SRV_FEEDBACK  for values in (311) partition by range (CREATETIME); 
create table PART_312 partition of CH_SRV_FEEDBACK  for values in (312) partition by range (CREATETIME); 
create table PART_313 partition of CH_SRV_FEEDBACK  for values in (313) partition by range (CREATETIME);
create table PART_314 partition of CH_SRV_FEEDBACK  for values in (314) partition by range (CREATETIME);
create table PART_315 partition of CH_SRV_FEEDBACK  for values in (315) partition by range (CREATETIME);
create table PART_316 partition of CH_SRV_FEEDBACK  for values in (316) partition by range (CREATETIME);
create table PART_317 partition of CH_SRV_FEEDBACK  for values in (317) partition by range (CREATETIME);
create table PART_318 partition of CH_SRV_FEEDBACK  for values in (318) partition by range (CREATETIME);
create table PART_319 partition of CH_SRV_FEEDBACK  for values in (319) partition by range (CREATETIME);

create table PART_310_202001 partition of PART_310 for values from ('2020-01-01') to ('2020-02-01');		   
create table PART_310_202002 partition of PART_310 for values from ('2020-02-01') to ('2020-03-01');							   
create table PART_310_202003 partition of PART_310 for values from ('2020-03-01') to ('2020-04-01');
create table PART_310_202004 partition of PART_310 for values from ('2020-04-01') to ('2020-05-01');
create table PART_310_202005 partition of PART_310 for values from ('2020-05-01') to ('2020-06-01');
create table PART_310_202006 partition of PART_310 for values from ('2020-06-01') to ('2020-07-01');
create table PART_310_202007 partition of PART_310 for values from ('2020-07-01') to ('2020-08-01');
create table PART_310_202008 partition of PART_310 for values from ('2020-08-01') to ('2020-09-01');
create table PART_310_202009 partition of PART_310 for values from ('2020-09-01') to ('2020-10-01');
create table PART_310_202010 partition of PART_310 for values from ('2020-10-01') to ('2020-11-01');
create table PART_310_202011 partition of PART_310 for values from ('2020-11-01') to ('2020-12-01');
create table PART_310_202012 partition of PART_310 for values from ('2020-12-01') to ('2021-01-01');



wenxin=> \d+ CH_SRV_FEEDBACK
                                          Partitioned table "public.ch_srv_feedback"
   Column   |          Type           | Collation | Nullable |        Default         | Storage  | Stats target | Description 
------------+-------------------------+-----------+----------+------------------------+----------+--------------+-------------
 surveyid   | character varying(32)   |           | not null |                        | extended |              | 
 itemid     | character varying(32)   |           | not null |                        | extended |              | 
 operid     | character varying(32)   |           | not null |                        | extended |              | 
 optionid   | character varying(2)    |           | not null | '0'::character varying | extended |              | 
 region     | bigint                  |           | not null |                        | plain    |              | 
 answer     | character varying(1024) |           |          |                        | extended |              | 
 createtime | date                    |           | not null |                        | plain    |              | 
Partition key: LIST (region)
Partitions: part_310 FOR VALUES IN ('310'), PARTITIONED,
            part_311 FOR VALUES IN ('311'), PARTITIONED,
            part_312 FOR VALUES IN ('312'), PARTITIONED,
            part_313 FOR VALUES IN ('313'), PARTITIONED,
            part_314 FOR VALUES IN ('314'), PARTITIONED,
            part_315 FOR VALUES IN ('315'), PARTITIONED,
            part_316 FOR VALUES IN ('316'), PARTITIONED,
            part_317 FOR VALUES IN ('317'), PARTITIONED,
            part_318 FOR VALUES IN ('318'), PARTITIONED,
            part_319 FOR VALUES IN ('319'), PARTITIONED

wenxin=>  \d+ CH_SRV_FEEDBACK part_310
                                          Partitioned table "public.ch_srv_feedback"
   Column   |          Type           | Collation | Nullable |        Default         | Storage  | Stats target | Description 
------------+-------------------------+-----------+----------+------------------------+----------+--------------+-------------
 surveyid   | character varying(32)   |           | not null |                        | extended |              | 
 itemid     | character varying(32)   |           | not null |                        | extended |              | 
 operid     | character varying(32)   |           | not null |                        | extended |              | 
 optionid   | character varying(2)    |           | not null | '0'::character varying | extended |              | 
 region     | bigint                  |           | not null |                        | plain    |              | 
 answer     | character varying(1024) |           |          |                        | extended |              | 
 createtime | date                    |           | not null |                        | plain    |              | 
Partition key: LIST (region)
Partitions: part_310 FOR VALUES IN ('310'), PARTITIONED,
            part_311 FOR VALUES IN ('311'), PARTITIONED,
            part_312 FOR VALUES IN ('312'), PARTITIONED,
            part_313 FOR VALUES IN ('313'), PARTITIONED,
            part_314 FOR VALUES IN ('314'), PARTITIONED,
            part_315 FOR VALUES IN ('315'), PARTITIONED,
            part_316 FOR VALUES IN ('316'), PARTITIONED,
            part_317 FOR VALUES IN ('317'), PARTITIONED,
            part_318 FOR VALUES IN ('318'), PARTITIONED,
            part_319 FOR VALUES IN ('319'), PARTITIONED


wenxin-> \d+  part_310
                                             Partitioned table "public.part_310"
   Column   |          Type           | Collation | Nullable |        Default         | Storage  | Stats target | Description 
------------+-------------------------+-----------+----------+------------------------+----------+--------------+-------------
 surveyid   | character varying(32)   |           | not null |                        | extended |              | 
 itemid     | character varying(32)   |           | not null |                        | extended |              | 
 operid     | character varying(32)   |           | not null |                        | extended |              | 
 optionid   | character varying(2)    |           | not null | '0'::character varying | extended |              | 
 region     | bigint                  |           | not null |                        | plain    |              | 
 answer     | character varying(1024) |           |          |                        | extended |              | 
 createtime | date                    |           | not null |                        | plain    |              | 
Partition of: ch_srv_feedback FOR VALUES IN ('310')
Partition constraint: ((region IS NOT NULL) AND (region = '310'::bigint))
Partition key: RANGE (createtime)
Partitions: part_310_202001 FOR VALUES FROM ('2020-01-01') TO ('2020-02-01'),
            part_310_202002 FOR VALUES FROM ('2020-02-01') TO ('2020-03-01'),
            part_310_202003 FOR VALUES FROM ('2020-03-01') TO ('2020-04-01'),
            part_310_202004 FOR VALUES FROM ('2020-04-01') TO ('2020-05-01'),
            part_310_202005 FOR VALUES FROM ('2020-05-01') TO ('2020-06-01'),
            part_310_202006 FOR VALUES FROM ('2020-06-01') TO ('2020-07-01'),
            part_310_202007 FOR VALUES FROM ('2020-07-01') TO ('2020-08-01'),
            part_310_202008 FOR VALUES FROM ('2020-08-01') TO ('2020-09-01'),
            part_310_202009 FOR VALUES FROM ('2020-09-01') TO ('2020-10-01'),
            part_310_202010 FOR VALUES FROM ('2020-10-01') TO ('2020-11-01'),
            part_310_202011 FOR VALUES FROM ('2020-11-01') TO ('2020-12-01'),
            part_310_202012 FOR VALUES FROM ('2020-12-01') TO ('2021-01-01')
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值