Skip to content

Commit afdf2f5

Browse files
committed
Add documentation for declarative partitioning
1 parent e06bbc7 commit afdf2f5

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Diff for: README.md

+21
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ More interesting features are yet to come. Stay tuned!
7070
* Non-blocking [concurrent table partitioning](#data-migration);
7171
* FDW support (foreign partitions);
7272
* Various [GUC](#disabling-pg_pathman) toggles and configurable settings.
73+
* Partial support of [`declarative partitioning`](#declarative-partitioning) (from PostgreSQL 10).
7374

7475
## Installation guide
7576
To install `pg_pathman`, execute this in the module's directory:
@@ -410,6 +411,26 @@ AS SELECT * FROM @[email protected]_cache_stats();
410411
```
411412
Shows memory consumption of various caches.
412413

414+
## Declarative partitioning
415+
416+
From PostgreSQL 10 `ATTACH PARTITION`, `DETACH PARTITION`
417+
and `CREATE TABLE .. PARTITION OF` commands could be with with tables
418+
partitioned by `pg_pathman`:
419+
420+
```plpgsql
421+
CREATE TABLE child1 (LIKE partitioned_table);
422+
423+
--- attach new partition
424+
ALTER TABLE partitioned_table ATTACH PARTITION child1
425+
FOR VALUES FROM ('2015-05-01') TO ('2015-06-01');
426+
427+
--- detach the partition
428+
ALTER TABLE partitioned_table DETACH PARTITION child1;
429+
430+
-- create a partition
431+
CREATE TABLE child2 PARTITION OF partitioned_table
432+
FOR VALUES IN ('2015-05-01', '2015-06-01');
433+
```
413434

414435
## Custom plan nodes
415436
`pg_pathman` provides a couple of [custom plan nodes](https://wiki.postgresql.org/wiki/CustomScanAPI) which aim to reduce execution time, namely:

0 commit comments

Comments
 (0)