PG-分区
建分区表语句:
PG版本为: PostgreSQL 11.8
声明式分区表(推荐):
创建表时并 指定分区字段 为logdate
CREATE TABLE measurement (
city_id int not null,
logdate date not null,
peaktemp int,
unitsales int
) PARTITION BY RANGE (logdate);
创建两个分区表 measurement_y2020m09 、 measurement_y2020m09
CREATE TABLE measurement_y2020m09 PARTITION OF measurement
FOR VALUES FROM ('2020-09-01') TO ('2020-10-01');
CREATE TABLE measurement_y2020m09 PARTITION OF measure