分区拆分
最近更新时间: 2025-02-18 16:02:00
postgres=# \d+ t_native_range
Table "tbase_pg_proc.t_native_range"
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
--------+-----------------------------+-----------+----------+---------+---------+--------------+-------------
f1 | bigint | | | | plain | |
f2 | timestamp without time zone | | | now() | plain | |
f3 | integer | | | | plain | |
Partition key: RANGE (f2)
Partitions: t_native_range_201708 FOR VALUES FROM ('2017-08-01 00:00:00') TO ('2017-09-01 00:00:00'),
t_native_range_201709 FOR VALUES FROM ('2017-09-01 00:00:00') TO ('2017-10-01 00:00:00'),
t_native_range_201710 FOR VALUES FROM ('2017-10-01 00:00:00') TO ('2017-11-01 00:00:00'),
t_native_range_minvalue FOR VALUES FROM (MINVALUE) TO ('2017-08-01 00:00:00'),
t_native_range_default DEFAULT
Distribute By: SHARD(f1)
Location Nodes: ALL DATANODES
将t_native_range_minvalue拆分成
(MINVALUE) TO ('2017-07-01 00:00:00')
('2017-07-01 00:00:00') TO ('2017-08-01 00:00:00')
postgres=# alter table t_native_range split partition t_native_range_minvalue at ('2017-07-01') into (partition t_native_range_minvalue_201706, partition t_native_range_201707);
ALTER TABLE
postgres=# \d+ t_native_range
Table "tbase_pg_proc.t_native_range"
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
--------+-----------------------------+-----------+----------+---------+---------+--------------+-------------
f1 | bigint | | | | plain | |
f2 | timestamp without time zone | | | now() | plain | |
f3 | integer | | | | plain | |
Partition key: RANGE (f2)
Partitions: t_native_range_201707 FOR VALUES FROM ('2017-07-01 00:00:00') TO ('2017-08-01 00:00:00'),
t_native_range_201708 FOR VALUES FROM ('2017-08-01 00:00:00') TO ('2017-09-01 00:00:00'),
t_native_range_201709 FOR VALUES FROM ('2017-09-01 00:00:00') TO ('2017-10-01 00:00:00'),
t_native_range_201710 FOR VALUES FROM ('2017-10-01 00:00:00') TO ('2017-11-01 00:00:00'),
t_native_range_minvalue_201706 FOR VALUES FROM (MINVALUE) TO ('2017-07-01 00:00:00'),
t_native_range_default DEFAULT
Distribute By: SHARD(f1)
Location Nodes: ALL DATANODES