You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
@@ -77,14 +78,29 @@ Done! Now it's time to setup your partitioning schemes.
77
78
78
79
>**Important:** Don't forget to set the`PG_CONFIG` variable in case you want to test`pg_pathman` on a custom build of PostgreSQL. Read more[here](https://wiki.postgresql.org/wiki/Building_and_Installing_PostgreSQL_Extension_Modules).
79
80
81
+
##How to update
82
+
In order to update pg_pathman:
83
+
84
+
1. Install the latest_stable_ release of pg_pathman.
85
+
2. Restart your PostgreSQL cluster.
86
+
3. Execute the following queries:
87
+
88
+
```plpgsql
89
+
/* replace X.Y with the version number, e.g. 1.3*/
90
+
ALTER EXTENSION pg_pathmanUPDATE TO"X.Y";
91
+
SETpg_pathman.enable= t;
92
+
```
93
+
80
94
##Available functions
81
95
82
96
###Partition creation
83
97
```plpgsql
84
98
create_hash_partitions(relation REGCLASS,
85
99
attributeTEXT,
86
100
partitions_countINTEGER,
87
-
partition_dataBOOLEAN DEFAULT TRUE)
101
+
partition_dataBOOLEAN DEFAULT TRUE,
102
+
partition_namesTEXT[] DEFAULTNULL,
103
+
tablespacesTEXT[] DEFAULTNULL)
88
104
```
89
105
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()`).
Performs RANGE partitioning for`relation` by partitioning key`attribute`.`start_value` argument specifies initial value,`interval` sets the rangeof values in a singlepartition,`count` is the number of premade partitions (if not set thenpathman tries to determine it based on attribute values). Partition creation callback is invoked for each partition if set beforehand.
122
+
Performs RANGE partitioning for`relation` by partitioning key`attribute`,`start_value` argument specifies initial value,`p_interval` sets thedefaultrangefor auto created partitions or partitions created with`append_range_partition()` or`prepend_range_partition()` (if`NULL` then autopartition 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.
107
123
108
124
```plpgsql
109
125
create_partitions_from_range(relation REGCLASS,
@@ -148,9 +164,9 @@ Same as above, but for a RANGE-partitioned table.
148
164
149
165
###Post-creation partition management
150
166
```plpgsql
151
-
replace_hash_partition(old_partitionREGCLASS,
152
-
new_partitionREGCLASS,
153
-
lock_parentBOOL DEFAULT TRUE)
167
+
replace_hash_partition(old_partition REGCLASS,
168
+
new_partition REGCLASS,
169
+
lock_parent BOOL DEFAULT TRUE)
154
170
```
155
171
Replaces specified partition of HASH-partitioned table with another table. The`lock_parent` parameter will prevent any INSERT/UPDATE/ALTER TABLE queries to parent table.
Merge two adjacent RANGE partitions. First, data from`partition2` is copied to`partition1`, then`partition2` is removed.
169
185
186
+
```plpgsql
187
+
merge_range_partitions(partitions REGCLASS[])
188
+
```
189
+
Merge several adjacent RANGE partitions (partitions must be specified in ascending or descending order). All the data will be accumulated in the first partition.
Create new RANGE partition for`relation` with specified range bounds.
212
+
Create new RANGE partition for`relation` with specified range bounds. If`start_value` or`end_value` are NULL then corresponding range bound will be infinite.
@@ -222,6 +243,12 @@ Drop partitions of the `parent` table (both foreign and local relations). If `de
222
243
223
244
###Additional parameters
224
245
246
+
247
+
```plpgsql
248
+
set_interval(relation REGCLASS, value ANYELEMENT)
249
+
```
250
+
Update RANGE partitioned table interval. Note that interval must not be negative and it must not be trivial, i.e. its value should be greater than zero for numeric types, at least 1 microsecond for`TIMESTAMP` and at least 1 day for`DATE`.