创建时间范围分区表
最近更新时间: 2025-02-18 16:02:00
postgres=# create table t_time_range
(f1 bigint, f2 timestamp ,f3 bigint)
partition by range (f2) begin (timestamp without time zone '2017-09-01 0:0:0')
step (interval '1 month')
partitions (12) distribute by shard(f1)
to group default_group;
CREATE TABLE
postgres=# \d+ t_time_range
Table "public.t_time_range"
Column | Type | Modifiers | Storage | Stats target | Description
--------+-----------------------------+-----------+---------+--------------+-------------
f1 | bigint | | plain | |
f2 | timestamp without time zone | | plain | |
f3 | bigint | | plain | |
Has OIDs: no
Distribute By SHARD(f1)
Location Nodes: ALL DATANODES
Partition By: RANGE(f2)
# Of Partitions: 12
Start With: 2017-09-01
Interval Of Partition: 1 MONTH