From Mounesh & co.
@dsandip @coco98 can you add more details please ? Is this in PG 11?
Supports table partitioning, but each parition has to be manually created:
CREATE TABLE measurement (
logdate date not null,
peaktemp int,
unitsales int
) PARTITION BY RANGE (logdate);
CREATE TABLE measurement_y2017 PARTITION OF measurement
FOR VALUES FROM ('2017-01-01') TO ('2018-01-01');
CREATE TABLE measurement_y2018 PARTITION OF measurement
FOR VALUES FROM ('2018-01-01') TO ('2019-01-01');
Similarly indicies has to be manually managed:
CREATE INDEX ON measurement_y2017 (logdate);
CREATE INDEX ON measurement_y2018 (logdate);
Then:
select on the parent table is handled by the query planner to gather results from the partitionsinsert on the parent table will automatically be inserted to the correct partition; if no corresponding partition exist, if will failINSERT INTO measurement VALUES ('2016-10-09', 66, 23) will failupdate on the parent table works as long as new data does not require moving partitionsdelete on the parent table worksCREATE TABLE city (
id SERIAL PRIMARY KEY,
name TEXT
);
CREATE TABLE measurement (
logdate date not null,
peaktemp int,
unitsales int,
city_id int REFERENCES city(id)
) PARTITION BY RANGE (logdate);
CREATE TABLE measurement_y2017 PARTITION OF measurement
FOR VALUES FROM ('2017-01-01') TO ('2018-01-01');
CREATE TABLE measurement_y2018 PARTITION OF measurement
FOR VALUES FROM ('2018-01-01') TO ('2019-01-01');
CREATE TABLE measurement_default PARTITION OF measurement DEFAULT;
CREATE INDEX ON measurement (logdate);
Index creation on partition tables are automatic (even for future partitions, pg will automagically create indicies).
+1 ;)
Any update on this?
We can track partitioned tables via API (track_table) but it doesn't show in console (#5071). Furthermore, we need to do the following
Closing this now as console support is added in v1.2 onwards, we will create separate issues for above points (if required).
Most helpful comment
Postgres 10 - partitioned tables
HGE compatibility
Limitations:
More Details:
Supports table partitioning, but each parition has to be manually created:
Similarly indicies has to be manually managed:
Then:
selecton the parent table is handled by the query planner to gather results from the partitionsinserton the parent table will automatically be inserted to the correct partition; if no corresponding partition exist, if will faile.g -
INSERT INTO measurement VALUES ('2016-10-09', 66, 23)will failupdateon the parent table works as long as new data does not require moving partitionsdeleteon the parent table worksPostgres 11 - partitioned tables
HGE compatibility
Notes:
More details:
Index creation on partition tables are automatic (even for future partitions, pg will automagically create indicies).