| -- Given an unlogged partition table with two leaf partitions |
| CREATE UNLOGGED TABLE unlogged_pt1(a int) PARTITION BY RANGE(a) (START(1) END(4) EVERY (2)); |
| NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Apache Cloudberry data distribution key for this table. |
| HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. |
| SELECT relpersistence, relname FROM pg_class WHERE relname like 'unlogged_pt1%'; |
| relpersistence | relname |
| ----------------+---------------------- |
| u | unlogged_pt1 |
| u | unlogged_pt1_1_prt_1 |
| u | unlogged_pt1_1_prt_2 |
| (3 rows) |
| |
| -- When I split the first partition |
| ALTER TABLE unlogged_pt1 SPLIT PARTITION FOR(2) AT(2) INTO (PARTITION p1, PARTITION p2); |
| -- Then the resulting two new relations have relation persistence type 'u' for unlogged |
| SELECT relpersistence, relname FROM pg_class WHERE relname like 'unlogged_pt1%'; |
| relpersistence | relname |
| ----------------+----------------------- |
| u | unlogged_pt1 |
| u | unlogged_pt1_1_prt_2 |
| u | unlogged_pt1_1_prt_p1 |
| u | unlogged_pt1_1_prt_p2 |
| (4 rows) |
| |
| -- Given a permanent table |
| CREATE TABLE perm_tab(a INT); |
| NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Apache Cloudberry data distribution key for this table. |
| HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. |
| -- When I exchange partition 2 from unlogged_pt1 with this permanent table, perm_tab |
| ALTER TABLE unlogged_pt1 EXCHANGE PARTITION FOR (3) WITH TABLE perm_tab; |