In [1], it is suggested that it might be a good idea to support
specifying the tablespace for each merged/split partition.

We can do the following after this feature is supported:

CREATE TABLESPACE tblspc LOCATION '/tmp/tblspc';
CREATE TABLE t (i int PRIMARY KEY) PARTITION BY RANGE (i);
CREATE TABLE tp_0_1 PARTITION OF t FOR VALUES FROM (0) TO (1);
CREATE TABLE tp_1_2 PARTITION OF t FOR VALUES FROM (1) TO (2);

ALTER TABLE t MERGE PARTITIONS (tp_0_1, tp_1_2) INTO tp_0_2 TABLESPACE tblspc;

ALTER TABLE t SPLIT PARTITION tp_0_2 INTO
    (PARTITION tp_0_1 FOR VALUES FROM (0) TO (1) TABLESPACE tblspc,
    PARTITION tp_1_2 FOR VALUES FROM (1) TO (2));

[1] 
https://www.postgresql.org/message-id/abaf390b-3320-40a5-8815-ef476db5c...@oss.nttdata.com

-- 
Regards
Junwang Zhao

Attachment: 0001-support-specify-tablespace-for-each-merged-split.patch
Description: Binary data

Reply via email to