Skip to content

Commit 56c61e5

Browse files
committed
update README.md
1 parent 15e74e3 commit 56c61e5

File tree

1 file changed

+38
-12
lines changed

1 file changed

+38
-12
lines changed

README.md

+38-12
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@
77

88
The `pg_pathman` module provides optimized partitioning mechanism and functions to manage partitions.
99

10-
The extension is compatible with PostgreSQL 9.5+.
10+
The extension is compatible with:
11+
* PostgreSQL 9.5, 9.6, 10;
12+
* Postgres Pro Standard 9.5, 9.6;
13+
* Postgres Pro Enterprise;
14+
15+
By the way, we have a growing Wiki [out there](https://github.com/postgrespro/pg_pathman/wiki);
1116

1217
## Overview
1318
**Partitioning** means splitting one large table into smaller pieces. Each row in such table is moved to a single partition according to the partitioning key. PostgreSQL supports partitioning via table inheritance: each partition must be created as a child table with CHECK CONSTRAINT. For example:
@@ -41,6 +46,7 @@ More interesting features are yet to come. Stay tuned!
4146
## Feature highlights
4247

4348
* HASH and RANGE partitioning schemes;
49+
* Partitioning by expression and composite key;
4450
* Both automatic and manual partition management;
4551
* Support for integer, floating point, date and other types, including domains;
4652
* Effective query planning for partitioned tables (JOINs, subselects etc);
@@ -55,9 +61,11 @@ More interesting features are yet to come. Stay tuned!
5561
* Various GUC toggles and configurable settings.
5662

5763
## Roadmap
64+
65+
* Multi-level partitioning (ver 1.5);
66+
* Improved referential integrity + foreign keys on partitioned tables (ver 1.5);
5867

59-
* Implement LIST partitioning scheme;
60-
* Optimize hash join (both tables are partitioned by join key).
68+
Take a look at [this page](https://github.com/postgrespro/pg_pathman/wiki/Roadmap);
6169

6270
## Installation guide
6371
To install `pg_pathman`, execute this in the module's directory:
@@ -97,30 +105,30 @@ SET pg_pathman.enable = t;
97105
### Partition creation
98106
```plpgsql
99107
create_hash_partitions(relation REGCLASS,
100-
attribute TEXT,
108+
expr TEXT,
101109
partitions_count INTEGER,
102110
partition_data BOOLEAN DEFAULT TRUE,
103111
partition_names TEXT[] DEFAULT NULL,
104112
tablespaces TEXT[] DEFAULT NULL)
105113
```
106-
Performs HASH partitioning for `relation` by integer key `attribute`. The `partitions_count` parameter specifies the number of partitions to create; it cannot be changed afterwards. If `partition_data` is `true` then all the data will be automatically copied from the parent table to partitions. Note that data migration may took a while to finish and the table will be locked until transaction commits. See `partition_table_concurrently()` for a lock-free way to migrate data. Partition creation callback is invoked for each partition if set beforehand (see `set_init_callback()`).
114+
Performs HASH partitioning for `relation` by partitioning expression `expr`. The `partitions_count` parameter specifies the number of partitions to create; it cannot be changed afterwards. If `partition_data` is `true` then all the data will be automatically copied from the parent table to partitions. Note that data migration may took a while to finish and the table will be locked until transaction commits. See `partition_table_concurrently()` for a lock-free way to migrate data. Partition creation callback is invoked for each partition if set beforehand (see `set_init_callback()`).
107115

108116
```plpgsql
109117
create_range_partitions(relation REGCLASS,
110-
attribute TEXT,
118+
expr TEXT,
111119
start_value ANYELEMENT,
112120
p_interval ANYELEMENT,
113121
p_count INTEGER DEFAULT NULL
114122
partition_data BOOLEAN DEFAULT TRUE)
115123

116124
create_range_partitions(relation REGCLASS,
117-
attribute TEXT,
125+
expr TEXT,
118126
start_value ANYELEMENT,
119127
p_interval INTERVAL,
120128
p_count INTEGER DEFAULT NULL,
121129
partition_data BOOLEAN DEFAULT TRUE)
122130
```
123-
Performs RANGE partitioning for `relation` by partitioning key `attribute`, `start_value` argument specifies initial value, `p_interval` sets the default range for auto created partitions or partitions created with `append_range_partition()` or `prepend_range_partition()` (if `NULL` then auto partition creation feature won't work), `p_count` is the number of premade partitions (if not set then `pg_pathman` tries to determine it based on attribute values). Partition creation callback is invoked for each partition if set beforehand.
131+
Performs RANGE partitioning for `relation` by partitioning expression `expr`, `start_value` argument specifies initial value, `p_interval` sets the default range for auto created partitions or partitions created with `append_range_partition()` or `prepend_range_partition()` (if `NULL` then auto partition creation feature won't work), `p_count` is the number of premade partitions (if not set then `pg_pathman` tries to determine it based on expression's values). Partition creation callback is invoked for each partition if set beforehand.
124132

125133

126134
### Data migration
@@ -141,7 +149,7 @@ Stops a background worker performing a concurrent partitioning task. Note: worke
141149
```plpgsql
142150
create_hash_update_trigger(parent REGCLASS)
143151
```
144-
Creates the trigger on UPDATE for HASH partitions. The UPDATE trigger isn't created by default because of the overhead. It's useful in cases when the key attribute might change.
152+
Creates the trigger on UPDATE for HASH partitions. The UPDATE trigger isn't created by default because of the overhead. It's useful in cases when the partitioning expression's value might change.
145153
```plpgsql
146154
create_range_update_trigger(parent REGCLASS)
147155
```
@@ -281,9 +289,10 @@ When INSERTing new data beyond the partitioning range, use SpawnPartitionsWorker
281289
```plpgsql
282290
CREATE TABLE IF NOT EXISTS pathman_config (
283291
partrel REGCLASS NOT NULL PRIMARY KEY,
284-
attname TEXT NOT NULL,
292+
expr TEXT NOT NULL,
285293
parttype INTEGER NOT NULL,
286-
range_interval TEXT);
294+
range_interval TEXT,
295+
cooked_expr TEXT);
287296
```
288297
This table stores a list of partitioned tables.
289298

@@ -325,7 +334,7 @@ RETURNS TABLE (
325334
parent REGCLASS,
326335
partition REGCLASS,
327336
parttype INT4,
328-
partattr TEXT,
337+
expr TEXT,
329338
range_min TEXT,
330339
range_max TEXT)
331340
AS 'pg_pathman', 'show_partition_list_internal'
@@ -336,6 +345,23 @@ AS SELECT * FROM show_partition_list();
336345
```
337346
This view lists all existing partitions, as well as their parents and range boundaries (NULL for HASH partitions).
338347

348+
### `pathman_cache_stats` --- per-backend memory consumption
349+
```plpgsql
350+
-- helper SRF function
351+
CREATE OR REPLACE FUNCTION @[email protected]_cache_stats()
352+
RETURNS TABLE (
353+
context TEXT,
354+
size INT8,
355+
used INT8,
356+
entries INT8)
357+
AS 'pg_pathman', 'show_cache_stats_internal'
358+
LANGUAGE C STRICT;
359+
360+
CREATE OR REPLACE VIEW @[email protected]_cache_stats
361+
AS SELECT * FROM @[email protected]_cache_stats();
362+
```
363+
Shows memory consumption of various caches.
364+
339365

340366
## Custom plan nodes
341367
`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)